rfc1867_empty_upload.phpt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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(6) {
  38. ["name"]=>
  39. string(9) "file1.txt"
  40. ["full_path"]=>
  41. string(9) "file1.txt"
  42. ["type"]=>
  43. string(16) "text/plain-file1"
  44. ["tmp_name"]=>
  45. string(%d) "%s"
  46. ["error"]=>
  47. int(0)
  48. ["size"]=>
  49. int(1)
  50. }
  51. ["file2"]=>
  52. array(6) {
  53. ["name"]=>
  54. string(0) ""
  55. ["full_path"]=>
  56. string(0) ""
  57. ["type"]=>
  58. string(0) ""
  59. ["tmp_name"]=>
  60. string(0) ""
  61. ["error"]=>
  62. int(4)
  63. ["size"]=>
  64. int(0)
  65. }
  66. ["file3"]=>
  67. array(6) {
  68. ["name"]=>
  69. string(9) "file3.txt"
  70. ["full_path"]=>
  71. string(9) "file3.txt"
  72. ["type"]=>
  73. string(16) "text/plain-file3"
  74. ["tmp_name"]=>
  75. string(%d) "%s"
  76. ["error"]=>
  77. int(0)
  78. ["size"]=>
  79. int(1)
  80. }
  81. }
  82. array(1) {
  83. ["foo"]=>
  84. string(0) ""
  85. }
  86. string(1) "1"
  87. string(1) "3"