Hi,
Bit of an odd request for a file upload application but I'm wondering if its possible to make the file upload field optional.
Recently purchased Xupload to handle the web forms on my company website but its not just being used for file uploading as the forms can just be simple customer enquiries too. Not all users will want to, or need to upload a file, so I'm wondering if its possible to make it optional some how?
Thanks for any help.
Jim.
XUpload - Making file upload optional
- PilgrimX182
- Posts: 2186
- Joined: Mar 22, 2006 1:39 pm
It is possiblee, only need to disable No Files validation:
in upload.cgi comment with '#' these lines:
and in xupload.js comment with '//' this line:
should work now even without files.
in upload.cgi comment with '#' these lines:
Code: Select all
if($#files==-1)
{
&lmsg("ERROR: No files uploaded");
sleep 2;
&DelData($temp_dir);
&xmessage("ERROR: No files uploaded");
}
Code: Select all
if(NF==0){alert('Select at least one file to upload');return false;};
Hi there,
I require this option too - making file uploads optional as I'm integrating this with another form.
I've followed these instructions which work fine bit one thing ->
How to stop the progress bar from appearing if no files are selected? I no longer receive a message telling me to choose a file but the progress bar appears all the same.
I'm using an inline bar by the way.
I've had a look at the openStatusWindow() function in upload.js but I couldn't see any easy way of making the show / hide call conditional on whether a file was being uploaded or not.
Am I missing something obvious?
I require this option too - making file uploads optional as I'm integrating this with another form.
I've followed these instructions which work fine bit one thing ->
How to stop the progress bar from appearing if no files are selected? I no longer receive a message telling me to choose a file but the progress bar appears all the same.
I'm using an inline bar by the way.
I've had a look at the openStatusWindow() function in upload.js but I couldn't see any easy way of making the show / hide call conditional on whether a file was being uploaded or not.
Am I missing something obvious?
- PilgrimX182
- Posts: 2186
- Joined: Mar 22, 2006 1:39 pm
In xupload.js find
and replace with
Code: Select all
setTimeout("openStatusWindow()",500);
Code: Select all
if(NF>0){setTimeout("openStatusWindow()",500);}