How to use the fileuploader in a form?

Jan 7, 2009 at 1:34 PM
Is it possible to use this control in a form or it can only used as a standalone, for example if I have a job request form where the user fill up some form fields like Full Name, Country, Age etc.. then uploads the resume then submit the form by clicking the form submit button (not the control's upload button) which will save the user record in a db and uploads the file. Is this possible?

Thanks in advance
Jan 7, 2009 at 5:32 PM
If you click the submit button then this will cause a postback, then what is the point of using asynchroneous upload control? Use the standard FileUpload instead.

On the other hand if you want to upload files and then submit the page you can do that:

function InitiateUpload(){
    var uploader = <%=FuleUploader1.ClientID%>;
    if(!!uploader.get_filesList() && uploader.get_filesList().length > 0){

<input type="button" value="Submit" onClick="InitiateUpload" />

Also use the client side code to initiate upload form when the files are being uploaded:

function FileStateChanged(uploader, file, httpStatus, isLast){
    Flajaxian.fileStateChanged(uploader, file, httpStatus, isLast);
    if(file.state > Flajaxian.File_Uploading && isLast){
} } </script> <fjx:FileUploader JsFunc_FileStateChanged="FileStateChanged" runat="server" > <Adapters> <fjx:FileSaverAdapter Runat="server" FolderName="UploadFolder" /> </Adapters> </fjx:FileUploader>
Jan 7, 2009 at 6:08 PM

You're saying that if I click the submit this will cause a postback, what if the form is inside an UpdatePanel control, then it will cause an asynchronous postback, will this still means I would use the standard FileUpload and there's no point of using the Flajaxian FileUploader, although I know that's not possible using the standard FileUpload inside an UpdatePanel.

I don't understand the if condition in the InitateUpload function, does it mean that it will start uploading only if I selected a file for upload and if not it will just submit the form?

Well, the current scenario I have is a form for adding media files which includes filling up form fields and uploading the media file (which is expected to be large in size) and there is a requirement to have a progress bar showing the progress of uploading (which is not available for the standard FileUpload) and to submit the form plus the file with just one submit button (not clicking the upload for the file, then clicking the submit for the form).

So I thought that the Flajaxian FileUploader would fit for my case but I didn't know how to use it for this scenario. Do you think it suits my case or I can't use it that way?