rfc1867_empty_upload.phpt 2.1 KB

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