note 97591 added to function.curl-setopt
| From: | obones_remove_me at free dot fr | Date: | Tue, 27 Apr 2010 10:27:11 +0000 |
| Subject: | note 97591 added to function.curl-setopt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168706@lists.php.net to get a copy of this message | ||
For those of you wondering how to specify the content-type for a file uploaded via curl, the syntax
is as follows:
<?php
$data = array('file' => '@/home/user/test.png;type=image/png');
?>
Simply adding a semicolon with the type= at the end.
Note that this has been reported not to work in all versions of PHP and I have done the following
tests:
5.2.6 (libcurl 7.18.2) : Does not work
5.2.13 (libcurl 7.20.0) : Works just fine
So it might be worth updating your installation of PHP and/or libcurl if you want to be able to use
this syntax
----
Server IP: 69.147.83.197
Probable Submitter: 82.67.45.121 (proxied: 127.0.0.1)
----
Manual Page -- http://www.php.net/manual/en/function.curl-setopt.php
Edit -- https://master.php.net/note/edit/97591
Del: integrated -- https://master.php.net/note/delete/97591/integrated
Del: useless -- https://master.php.net/note/delete/97591/useless
Del: bad code -- https://master.php.net/note/delete/97591/bad+code
Del: spam -- https://master.php.net/note/delete/97591/spam
Del: non-english -- https://master.php.net/note/delete/97591/non-english
Del: in docs -- https://master.php.net/note/delete/97591/in+docs
Del: other reasons-- https://master.php.net/note/delete/97591
Reject -- https://master.php.net/note/reject/97591
Search -- https://master.php.net/manage/user-notes.php