How to select multiple files for upload?

后端 未结 9 1820
暖寄归人
暖寄归人 2020-12-03 08:30

How to select multiple files for upload : \"enter

相关标签:
9条回答
  • 2020-12-03 09:12

    This depends on the browser. Newer versions of firefox and chrome support this because they started to implement HTML5 specification. This is the syntax:

    <input type="file" multiple=""/>
    

    Firefox >= 3.6, Chrome >= 2, Safari >= 4 support multiple file input.

    For older browsers the only good solutions are flash or javascript plugins. Here is a good resource for jquery uploaders ( some support multiple files ): http://creativefan.com/10-ajax-jquery-file-uploaders/

    0 讨论(0)
  • 2020-12-03 09:14

    I would definately at this point go with new HTML5 "multiple" attribute:

    <input type="file" name="upload[]" multiple="multiple" />
    

    The only viable alternative is FLASH plugins like swfupload.

    However - there are multiple prublems with using FLASH for uploads, the main one foor me would be cookie bug:

    FLASH plugins don't send cookies correctly. Each browser has it's own cookie storage.FLASH always sends cookies from IE even if you use Google Chrome for example. - result is that you loose cookies and sessions. there is a workaround - but it requires you to send session ID as GET or POST parameters which in turn makes your site vulnerable for session fixation.

    0 讨论(0)
  • 2020-12-03 09:14

    Use the file input form element more than once, give it a different name and you have multiple upload fields on one page. No need to learn anything else.

    0 讨论(0)
  • 2020-12-03 09:22

    As others have said, you have to use Flash to get multiple uploads. An alternative to uploadify is SWFUpload.

    0 讨论(0)
  • 2020-12-03 09:23

    There is no html/javascript workaround. You would have to look to flash or java to be able to do this.

    0 讨论(0)
  • 2020-12-03 09:35

    In HTML5 you can set the multiple attribute on <input type="file">. This works in browsers supporting HTML5.

    <input type="file" name="upload" multiple="multiple" />
    

    In HTML4 your best bet is Flash or Java Applet. There are 3rd party libs available like Uploadify, SWFupload, JUpload and JumpLoader.

    0 讨论(0)
提交回复
热议问题