views:

886

answers:

2

Everything was working fine in Internet Explorer 6 but it's not in Internet Explorer 8. I will appreciate help from anybody. I want to know what I should change to make it work in IE8.

This is the code I am using in the form:

<form METHOD="POST"
  ENCTYPE="multipart/form-data"
  name="form1"
  onSubmit="checkFileUpload(this,'GIF,JPG,JPEG',false,800,'','','','','','');return  document.MM_returnValue">

This is the javascript code I am using:

<script language="JavaScript">
  function checkFileUpload(form, extensions, requireUpload, sizeLimit, minWidth, minHeight, maxWidth, maxHeight) { //v2.09
    document.MM_returnValue = true;
    for (var i = 0; i<form.elements.length; i++) {
      field = form.elements[i];
      if (field.type.toUpperCase() != 'FILE') continue;
      checkOneFileUpload(field, extensions, requireUpload, sizeLimit, minWidth, minHeight, maxWidth, maxHeight);
    }
  }
</script>

Thanks

+2  A: 

I'm not sure why you have it structured at two statements, but this MAY help:

onSubmit="function() {checkFileUpload(this,'GIF,JPG,JPEG',false,800,'','','','','','');return document.MM_returnValue;}"
Josh Pearce
Thank you very much Josh for your help. It's working with that code.
Polonio
You're welcome. Can you please mark my comment as the answer?
Josh Pearce
A: 

I noticed that checkFileUpload is defined with 8 arguments and you're calling it with 10. Also, the last 4 or so look like numeric arguments, but you're calling it with strings.

I don't think it's onSubmit that's not working; and you could verify that by putting alerts in a few places. I think IE8 is being a little more critical of your programming.

I'm not a big Windows person, but I know there's an option in the Internet settings that tells IE to report errors to you. I think you should set that option.

Carl Smotricz