Hi,
We can think of one way that might work for you. It will be as follow:
1. Change LayoutTemplate to hide the default upload button. Note the button should not be removed; It is merely not visible. For example, you can put it inside a hidden div;
2. Replace your submit button with a simple HTML button so that by default it does not post back the page;
3. Handle the button's onclick event:
Code: JavaScript
function click_handler()
{
//Get the upload button
var uploadButton =
document.getElementById("AJAXUploader1_UploadButton");
if (uploadButton.disabled)
{
//Raises a normal post back if the upload button is disabled
//you will need to replace arguments to __doPostBack with
//appropriate values
__doPostBack(....);
}
else
{
//Otherwise go ahead with the upload, once the upload is
//is done the uploader will automatically submits the rest,
//assuming AutoPostBack is set to true
AJAXUploader1.upload();
}
}
There are two problems with this code:
1. It relies on our implementation details (with hardcoded UploadButton ID value);
2. It can fail if user selects a file that IE does not have permission to access; which causes uploadButton.disabled to be false (since a file is selected) but upload to fail. In reality this rarely happens because if user is able to select the file, he usually has read permission on that file;
The ideal solution is to extend upload to the uploader's client side API so that you will be able to query:
1. Whether user have selected any files;
2. Whether the upload was successful;
We will look into that and see if it is possible for us to add that.
Thanks