note 111978 added to function.curl-setopt
| From: | S.F. | Date: | Thu, 18 Apr 2013 18:48:58 +0000 |
| Subject: | note 111978 added to function.curl-setopt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194540@lists.php.net to get a copy of this message | ||
I spent a couple of days trying to upload a file using a curl post.
The problem I ran into was the filename had an '@' in the middle of it. It turned out
that at least on my system if I encoded the file path using the quoted_printable_encoding() function
the upload works.
I'm posting this in the hopes that it will help someone else, and for my own future reference.
Code:
<?php
$filepath = '/tmp/test@example.txt';
$postdata['file'] = '@' . quoted_printable_encoding();
//... supporting code.
$result = curl_exec($ch);
?>
I'm not exactly sure why this works when escaping the '@' doesn't work but it
does for me.
If anyone can offer insight into why this works or a better way to handle the '@' symbol
in a filename when using curl to upload I would love to hear it.
Thanks
----
Server IP: 192.41.42.26
Probable Submitter: 166.70.157.243
----
Manual Page -- http://php.net/manual/en/function.curl-setopt.php
Edit -- https://master.php.net/note/edit/111978
Del: integrated -- https://master.php.net/note/delete/111978/integrated
Del: useless -- https://master.php.net/note/delete/111978/useless
Del: bad code -- https://master.php.net/note/delete/111978/bad+code
Del: spam -- https://master.php.net/note/delete/111978/spam
Del: non-english -- https://master.php.net/note/delete/111978/non-english
Del: in docs -- https://master.php.net/note/delete/111978/in+docs
Del: other reasons-- https://master.php.net/note/delete/111978
Reject -- https://master.php.net/note/reject/111978
Search -- https://master.php.net/manage/user-notes.php