Created
January 23, 2011 05:47
-
-
Save marcinwol/791856 to your computer and use it in GitHub Desktop.
Example phpt file for testing file uploads
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--TEST-- | |
Example test emulating a file upload | |
--SKIPIF-- | |
<?php if (php_sapi_name()=='cli') die('skip'); ?> | |
--POST_RAW-- | |
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryfywL8UCjFtqUBTQn | |
------WebKitFormBoundaryfywL8UCjFtqUBTQn | |
Content-Disposition: form-data; name="file"; filename="example.txt" | |
Content-Type: text/plain | |
Some file data .... | |
------WebKitFormBoundaryfywL8UCjFtqUBTQn | |
Content-Disposition: form-data; name="submit" | |
Upload | |
------WebKitFormBoundaryfywL8UCjFtqUBTQn-- | |
--FILE-- | |
<?php | |
var_dump($_FILES['file']['name']); | |
?> | |
--EXPECT-- | |
string(11) "example.txt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment