BLACK FRIDAY Sale with 50% off starts in: 
Optional Upload?
May 4, 2001 by Diego Vargas


What can i do if the file that the users can upload is optional ?
The behavior convert required the field in my form, i need it optional !


Try deleting the form onSubmit action. This will disable the empty filename check - but it will also disable the Allowed Extensions check.

In the next version of Pure Upload this will be an option.

Place your comment about Optional Upload?

You must me logged in to write a comment
RE: Optional Upload Fix
March 27, 2002 by Phil Thurston

Hi,  I may be just plain stupid but I do not understand your fix for the optional upload?  Please can you explain exactly what I have to do?

Many Thanks


RE: Optional Upload Fix
June 9, 2001 by George Petrov
Very good Sam - this does the job even better!
Optional Upload Fix
June 9, 2001 by sam sam

Commenting out the following foure lines (marked in red)

 in the check extensions script worked for me, as follows


function checkFileUpload(form,extensions) { //v1.0
  document.MM_returnValue = true;
  if (extensions && extensions != '') {
    for (var i = 0; i<form.elements.length; i++) {
      field = form.elements[i];
      if (field.type.toUpperCase() != 'FILE') continue;
//      if (field.value == '') {
//       alert('File is required!');
//        document.MM_returnValue = false;field.focus();break;
//      }
      if (extensions.toUpperCase().indexOf(getFileExtension(field.value).toUpperCase()) == -1) {
        alert('This file is not allowed for uploading!');
        document.MM_returnValue = false;field.focus();break;
  } } }