Replies Back to Article

Optional Upload?

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

comments?

------------------------
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;
  } } }
}

-------------------------------

SAM

RE: Optional Upload Fix
June 9, 2001 by George Petrov
Very good Sam - this does the job even better!
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

Phil