|
Rank: Member Groups: Member
Joined: 3/26/2009 Posts: 18
|
Hi,
I am using the AJAX uploader and am using server side validation, on submitting the form, to check whether collectively the files I've uploaded are not over a certain file size. On validation failure postback the delete button does not display and so am unable to delete any files. to rectify the problem.
I am using the control in the format below.
<eo:CallbackPanel runat="server" id="CallbackPanel1" Triggers="{ControlID:AJAXUploader1;Parameter:}"> <eo:AJAXUploader ProgressDialogID="AJAXUploaderProgressDialog1" id="AJAXUploader1" runat="server" TempFileLocation="~/EOTempUpload" Width="400px"></eo:AJAXUploader> </eo:CallbackPanel>
Is there I need to do to fix this problem?
Also what would be the best method to validate this client side?
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Delete is for you to delete unsubmitted files, so once they are submitted, you will no longer be able to delete them. I understand the word "submitting" is a bit confusing. The whole flow is like this:
1. A page post back occurs; 2. FileUploaded event is called. At this point AJAXUploader handles all files over to your code; 3. You perform certain validation logics and drop files that fails the validation; 4. You continue to process the files that passes the validation;
From the AJAXUploader's point of view, as soon as it hand over the files to your code, it is done. And you won't be able to "return" this file to user and ask user to modify it.
You can however use a separate list to keep these files and display it alongside the uploader. You can then code to allow user to use that list to remove files and use uploader to add files. A built in AJAXPostedFileList control is provided for such purpose, but it only supports limited customization options. The point is you can use a complete separate list without having much to do with the uploader at all.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 3/26/2009 Posts: 18
|
Thanks for the reply, this is clearer now.
Are there any examples of creating custom client side validation?
Thanks,
James
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You will need to handle the uploader's ClientSideOnError event, then check whether the error code is "max_size_exceeded": http://doc.essentialobjects.com/library/1/jsdoc.public.handlers.clientside_error_handler.aspxIf you are not familiar with our client side interface, you will want to go over this topic: http://doc.essentialobjects.com/library/1/clientapi_howto.aspxThis allows you to detect such a situation, you can then write other code to rely on this information to carry out whatever logic you would like to perform. Note the event only occurs after you intend to upload. If you do not want user to always press the upload button, you can set the uploader's AutoUpload to true. Thanks!
|
|