php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49196 PHP could not understand multi files Web Forms 2.0 request
Submitted: 2009-08-08 07:53 UTC Modified: 2009-08-09 20:33 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:0 (0.0%)
From: mikhail dot v dot gavrilov at gmail dot com Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 5.3.0 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mikhail dot v dot gavrilov at gmail dot com
New email:
PHP Version: OS:

 

 [2009-08-08 07:53 UTC] mikhail dot v dot gavrilov at gmail dot com
Description:
------------
Opera browser a support Web Forms 2.0, it allows easy build uploading multiple files form. Below given a fragment of html code demonstrates it. (In file open dialog you can select few files)

<form action="upload.php" name="acp_users" enctype="multipart/form-data" method="post">
   <input type="file" min="1" max="9999" name="file"/>
   <input type="submit" name="submit" value="Zagruzit"/>
</form>


Now the problem is that PHP does not understand http request from a browser with multiple file's selected. ($_FILES array is empty).

Reproduce code:
---------------
Upload to server a few files through Opera, by described above method.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-08 08:39 UTC] mikhail dot v dot gavrilov at gmail dot com
Expected that array $_FILES would be filled, but instead recieve all content in $_POST array, for example:

Array
(
    [file] =>
------------WABJYWB4BD24HFXX0Tt6AT
Content-Disposition: form-data; name="file"; filename="test.php"
Content-Type: application/octet-stream

Content of first file
------------WABJYWB4BD24HFXX0Tt6AT
Content-Disposition: form-data; name="file"; filename="SP0921700001.XML"
Content-Type: text/xml

Content of second file
------------WABJYWB4BD24HFXX0Tt6AT--
    [submit] => Upload
)
 [2009-08-09 14:51 UTC] jani@php.net
Check the example 3 here:
  
  http://www.php.net/upload 

 [2009-08-09 14:52 UTC] jani@php.net
Wrong url, here's the complete page:

  http://www.php.net/manual/en/features.file-upload.multiple.php

 [2009-08-09 20:33 UTC] mikhail dot v dot gavrilov at gmail dot com
Thanks for quick responce, but my example another.

My code above on latest Opera browser allows select many files in one field!

Please try example:

1) Create on your server index.html with next code:
<html>
  <body>
    <form action="upload.php" name="acp_users" enctype="multipart/form-data" method="post">
      <input type="file" min="1" max="9999" name="file"/>
      <input type="submit" name="submit" value="Upload"/>
    </form>
  </body>
</html>

2) Create in same directory upload.php
<?php
  print_r($_FILES);
  print_r($_POST);
?>

3) Dowload latest Opera 10

4) enter url index.html on your server.

5) Press "Add files" and select few files (not one!!!)

6) Press "Upload" and see php script result.

Thanks for testing.

--
Best Regards,
Mike Gavrilov.
 [2010-09-29 21:55 UTC] dev2bj at gmail dot com
Mike,

1. <input type="file" min="1" max="9999" name="file"/>

2. <input type="file" min="1" max="9999" name="file[]"/>

find difference.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Sep 28 17:03:37 2021 UTC