0

Good Day, I have a form with multiple file input fields. I have a script that automatically adds another file input field on change. This is for a image upload functionality ( so that the user can upload multiple images in one go ). In Firefox, it works fine, but it fails on ie8.

this how the form looks like when many images were selected

form.html

<form class="ysForm" action="uploadImage.php" encType="multipart/form-data" method="post">
<input name="ys-file_0" class="ysFile" type="file" multi_selector="[object Object]"/>
<input name="ys-file_1" class="ysFile" type="file" multi_selector="[object Object]"/>
<input name="ys-file_2" class="ysFile" type="file" multi_selector="[object Object]"/>
</form>

uploadImage.php

foreach( $_FILES as $theFile ) {
   //do image resize and save to a directory code
}

But uploadImage does not seem to get the image files. Please help

KiiroSora09
  • 2,247
  • 18
  • 21
  • I've never heard of the `multi_selector` attribute, but I'm fairly sure its value of `[object Object]` can't be right. – Niet the Dark Absol Jun 07 '12 at 02:52
  • @Kolink yeah, haven't heard of it, when my script generates the element on IE8, it just automatically appears. But it does not appear when I tried it on Firefox. – KiiroSora09 Jun 07 '12 at 03:20
  • So in other words, you're using some kind of framework and don't have a clue how it works. This is why I don't use frameworks. – Niet the Dark Absol Jun 07 '12 at 04:48

3 Answers3

1

According to other answers, such as the one here, IE8 doesn't support the multiple option for file inputs.

Community
  • 1
  • 1
srushe
  • 11
  • 1
0

IE8 doesn't support multiple file uploading with

You can see this info:

IE8 - input (type="file") get files

http://social.msdn.microsoft.com/Forums/en-US/f0e72657-962f-4254-b95c-c47482401899/multiple-file-uploading-in-ie9-and-older-versions?forum=ieextensiondevelopment

Community
  • 1
  • 1
Miguel
  • 1
  • 1
    While these links may be useful, if the links ever go dead, then the information in your post will be lost. Please edit the information from the links into your post – Kevin L Aug 06 '14 at 14:24
-1

Most modern browsers (including IE8) support multiple file uploading with a single dialog. The syntax is <input type="file" multiple="true" name="upload" />

Your form will call your php script multiple times, once for each image.

That being said, I suggest using Uploadify, http://www.uploadify.com/, as it's a lot easier. There are also some fancy JQuery based solutions.

Kyros
  • 512
  • 2
  • 5
  • Is this part of the HTML5 spec or have I just never heard of it? – Waleed Khan Jun 07 '12 at 02:55
  • @Kyros Thanks for the reply, I'm trying to develop a jQuery plugin for multiple file upload, including drag and drop for XHR2 supported browsers with a multi-file backfall. the backfall is currently working in firefox, but in IE8 it won't. Ok I will just try your suggestion on my fallback. – KiiroSora09 Jun 07 '12 at 03:18
  • 4
    IE 8 doesn't support the multiple attribute for file inputs. http://stackoverflow.com/questions/5987936/html5-input-type-files-multiple-attribute-not-working-in-ie – Larry Battle Jun 08 '12 at 09:10