rfc1867_empty_upload.phpt 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. --TEST--
  2. rfc1867 empty upload
  3. --INI--
  4. file_uploads=1
  5. upload_max_filesize=1024
  6. max_file_uploads=10
  7. --POST_RAW--
  8. Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737
  9. -----------------------------20896060251896012921717172737
  10. Content-Disposition: form-data; name="foo"
  11. -----------------------------20896060251896012921717172737
  12. Content-Disposition: form-data; name="file1"; filename="file1.txt"
  13. Content-Type: text/plain-file1
  14. 1
  15. -----------------------------20896060251896012921717172737
  16. Content-Disposition: form-data; name="file2"; filename=""
  17. Content-Type: text/plain-file2
  18. -----------------------------20896060251896012921717172737
  19. Content-Disposition: form-data; name="file3"; filename="file3.txt"
  20. Content-Type: text/plain-file3
  21. 3
  22. -----------------------------20896060251896012921717172737--
  23. --FILE--
  24. <?php
  25. var_dump($_FILES);
  26. var_dump($_POST);
  27. if (is_uploaded_file($_FILES["file1"]["tmp_name"])) {
  28. var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
  29. }
  30. if (is_uploaded_file($_FILES["file3"]["tmp_name"])) {
  31. var_dump(file_get_contents($_FILES["file3"]["tmp_name"]));
  32. }
  33. ?>
  34. --EXPECTF--
  35. array(3) {
  36. ["file1"]=>
  37. array(5) {
  38. ["name"]=>
  39. string(9) "file1.txt"
  40. ["type"]=>
  41. string(16) "text/plain-file1"
  42. ["tmp_name"]=>
  43. string(%d) "%s"
  44. ["error"]=>
  45. int(0)
  46. ["size"]=>
  47. int(1)
  48. }
  49. ["file2"]=>
  50. array(5) {
  51. ["name"]=>
  52. string(0) ""
  53. ["type"]=>
  54. string(0) ""
  55. ["tmp_name"]=>
  56. string(0) ""
  57. ["error"]=>
  58. int(4)
  59. ["size"]=>
  60. int(0)
  61. }
  62. ["file3"]=>
  63. array(5) {
  64. ["name"]=>
  65. string(9) "file3.txt"
  66. ["type"]=>
  67. string(16) "text/plain-file3"
  68. ["tmp_name"]=>
  69. string(%d) "%s"
  70. ["error"]=>
  71. int(0)
  72. ["size"]=>
  73. int(1)
  74. }
  75. }
  76. array(1) {
  77. ["foo"]=>
  78. string(0) ""
  79. }
  80. string(1) "1"
  81. string(1) "3"