|
Rank: Newbie Groups: Member
Joined: 3/16/2009 Posts: 9
|
Hello,
Is it possible to display only last uploaded file in PostedFilesPlaceHolder, and how? I am using the control with AutoUpload="true", but would like to display only the last file that has been uploaded. Customizing label format (getting rid of the checkbox) would also be useful...
Thanks in advance
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
There is no need to use PostedFilesPlaceHolder to display the last uploaded file. Just put a Label in your page (you do not need to put it inside the uploader's LayoutTemplate) and handle the Uploader's FileUploaded event, then update the Label whatever way you wanted based on the event arguments, which contains information about the uploaded files. Once you get this working, you would simply remove PostedFilesPlaceHolder from your LayoutTemplate.
Please let us know if this makes sense to you.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 3/16/2009 Posts: 9
|
Thanks for the quick reply, that does the job.
I'll get back to you as soon as I run into another problem :)
EDIT: Is there a way to catch FileUploaded event on a client via javascript?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
No. The closest you can have is this: http://doc.essentialobjects.com/library/1/eo.web.ajaxuploader.clientsideondone.aspxAlso check other ClientSideOnXXX properties on the uploader to see if any of them would be useful to you. If you are not familiar with our client side interface, you will want to go over this topic first: http://doc.essentialobjects.com/library/1/clientapi_howto.aspxThanks!
|
|
Rank: Newbie Groups: Member
Joined: 3/16/2009 Posts: 9
|
Quick question:
Can I stop uploader from making a postback if I catch error on client? For example, I don't want to make postback after catching "max_size_exceeded" error on client.
Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You do not need to stop the uploader to make a post back when an error occurs. The uploading process is automatically stopped. If you are interested in perform additional actions when an error occurs, you can handle this client side event: http://doc.essentialobjects.com/library/1/eo.web.control.clientsideonerror.aspxYou would check the arguments to determine the type of errors and then do whatever you would like to or would not like to do. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 3/16/2009 Posts: 9
|
Hi,
Sorry about this stupid question, I got it figured out. I had a line in ClientSiteOnCancel that caused postback...
I actually handle errors just like you described it...
Thanks againfor very quick reply!
|
|
Rank: Newbie Groups: Member
Joined: 3/16/2009 Posts: 9
|
Back to this question. OK, so I'm catching ClientSideOnDone event. What I'd like to do is access some information about the file that has been uploaded (e.g. name, size, etc). I tried using uploader's getPostedFiles method since I noticed that objects returned via this method have member methods such as getClientFileName. However, these methods do not return desired values.... So my question is: Can I access information about uploaded files on the clent side, after the upload is done, and how do I do it?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, Try to use setTimeout to delay call to getPostedFiles. For example, instead of calling:
Code: JavaScript
alert(uploader1.getPostedFiles().length);
Try to do:
Code: JavaScript
setTimeout(
function()
{
alert(uploader1.getPostedFiles().length);
}, 10);
The reason is the posted file list has not been set yet when ClientSideOnDone is called. So once you delay the call, you should get the correct value. Thanks!
|
|