Welcome Guest Search | Active Topics | Sign In | Register

Retreiveing the temp file name clientside Options
Foster42
Posted: Tuesday, February 5, 2008 5:26:03 AM
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
eo_support
Posted: Tuesday, February 5, 2008 5:41:15 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
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
Foster42
Posted: Tuesday, February 5, 2008 8:20:07 AM
Rank: Newbie
Groups: Member

Joined: 2/5/2008
Posts: 8
Also, I was wondering, is there a way to start the upload through javascript?
Foster42
Posted: Tuesday, February 5, 2008 8:21:24 AM
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
eo_support
Posted: Tuesday, February 5, 2008 8:45:35 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
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=1008

The 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
Foster42
Posted: Tuesday, February 5, 2008 11:33:53 AM
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?
Foster42
Posted: Tuesday, February 5, 2008 11:48:01 AM
Rank: Newbie
Groups: Member

Joined: 2/5/2008
Posts: 8
Oh, one other question, can you change the temp folder from the client?
eo_support
Posted: Tuesday, February 5, 2008 12:57:24 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
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
Foster42
Posted: Tuesday, February 5, 2008 1:00:19 PM
Rank: Newbie
Groups: Member

Joined: 2/5/2008
Posts: 8
Makes sense, thanks.
Foster42
Posted: Tuesday, February 5, 2008 5:20:11 PM
Rank: Newbie
Groups: Member

Joined: 2/5/2008
Posts: 8
Ok, one more Angel

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?
eo_support
Posted: Tuesday, February 5, 2008 5:33:22 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
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\_i0

Also try to run the local version and see if the result is the same.

Thanks
Foster42
Posted: Tuesday, February 5, 2008 5:40:48 PM
Rank: Newbie
Groups: Member

Joined: 2/5/2008
Posts: 8
You're right, that works fine, hmm, must be something I did, thanks.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.