|
Rank: Newbie Groups: Member
Joined: 2/5/2008 Posts: 8
|
I have a client side driven application that I'm trying to use the ajax file uploader on. I'm using it successfully to upload the file, fire off an event after the file is uploaded, etc.
What I want to do is call a webservice to manage the moving of the file and updating a field in the database, the problem I'm having is that I can see no way to determine what the name of the temp file is so I can pass that to my webservice.
Am I missing a property, or am I asking for something unsupported?
Best Regards, Jeff Foster
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Thanks for posting your question here. The property is AJAXPostedFile.TempFileName. You can get a list of posted files from AJAXUploader.PostedFiles property.
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 2/5/2008 Posts: 8
|
Also, I was wondering, is there a way to start the upload through javascript?
|
|
Rank: Newbie Groups: Member
Joined: 2/5/2008 Posts: 8
|
Thanks for your quick response, I'm using this code:
var PostedFiles = uploader.getPostedFiles(); for (var i = 0; i < PostedFiles.length; i++) { PostedFile = PostedFiles[i]; UploaderFileName.innerText = PostedFile.getClientFileName(); UploaderFileIdentifier.innerText = PostedFile.TempFileName; }
the getClientFileName() works, but the the .TempFileName is returning null/undefined, am I referencing it correctly?
Thanks again, Jeff
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Jeff, I see what you mean. What I was refering is the server side interface, not client side interface. The primary purpose of the client side interface is for you to display upload progress information, so they are only available during and after the upload, not before upload. Also TempFileName is never available on the client side. In another word, file move/processing must be done on the server side. Starting upload from JavaScript is possible, but unfortunately it's a little bit complicated as there is no single call to do so (we will probably add one). This topic has details on a related question: http://www.essentialobjects.com/Forum/Default.aspx?g=posts&t=1008The original question for that topic covers a broader question, one of the steps cover how to start uploading from JavaScript. So make sure you do not follow all the steps literally as outlined in that topic. As mentioned in the topic, you may also want to take a look of CallbackPanel. With CallbackPanel you can basically calls any server side code from client side. This helps when the interface that you are seeking is only available on the server side, like the TempFileName you are looking for. Thanks
|
|
Rank: Newbie Groups: Member
Joined: 2/5/2008 Posts: 8
|
I see, thanks for the information. Is there any possibility that TempFileName will be added to the client or anything else that might be able to be used to identify the file during the client session?
|
|
Rank: Newbie Groups: Member
Joined: 2/5/2008 Posts: 8
|
Oh, one other question, can you change the temp folder from the client?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
One of the reason that we do not expose TempFileName on the client side is for security purpose --- TempFileName is strictly a server side implementation detail so we feel reluctant to expose it to the client side because once it is exposed, it is not only exposed to your JavaScript code, it is exposed to anybody who uses your page.
Also no for your second question. TempFolder location should never be changed because AJAXUploader not only writes temp files into that folder, but also status information into that folder. So you shouldn't even change it on the server side. Usually you set it in design mode and never touch it again.
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 2/5/2008 Posts: 8
|
Makes sense, thanks.
|
|
Rank: Newbie Groups: Member
Joined: 2/5/2008 Posts: 8
|
Ok, one more It seems like uploaded percentage doesn't work right when uploading multiple times on the same uploader instance. If I upload once, percentage ticks up normally, but if I don't refresh the page and initiate another upload, it thinks its already 100%+ Does that seem right?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, Actually we are not aware of any problems like that. Can you run this sample page and see if the same problem occurs? http://www.essentialobjects.com/Demo/Default.aspx?path=AJAXUploader\_i0Also try to run the local version and see if the result is the same. Thanks
|
|
Rank: Newbie Groups: Member
Joined: 2/5/2008 Posts: 8
|
You're right, that works fine, hmm, must be something I did, thanks.
|
|