Created
November 30, 2012 19:19
-
-
Save sidchilling/4177891 to your computer and use it in GitHub Desktop.
CURL method to make POST request with file upload
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
<?php | |
$url = 'http://localhost/tests/upload_file'; #URL for the service | |
$file_path = '/home/siddharthsaha/Desktop/production.html'; # File to be uploaded | |
$data = array( | |
'owner' => 'siddharth saha', | |
'test_file' => '@' . $file_path # For files, you have to append a @ before the filepath. | |
); | |
# Make the curl request exactly as in the POST example above. | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment