-
-
Save kidker/4e7391d306c81e058b82230f7cbc82aa to your computer and use it in GitHub Desktop.
Curl Send File
This file contains hidden or 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
http://blog.derakkilgo.com/2009/06/07/send-a-file-via-post-with-curl-and-php/ | |
$file_name_with_full_path = realpath('./sample.jpeg'); | |
$post = array('extra_info' => '123456','file_contents'=>'@'.$file_name_with_full_path); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL,$target_url); | |
curl_setopt($ch, CURLOPT_POST,1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $post); | |
$result=curl_exec ($ch); | |
curl_close ($ch); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment