It's trivial to get image from server but I think about something different. It is crazy question but... Is it possible to send file (image) to a server but not using form upload or ftp connection? I want to send a request to eg. http://www.example.com/file.php with binary content. I think I need to set Content-type header image/jpeg but how to add some content to my request?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
The only code worked for me with PHP 7.0
Thanks to @AndyLin for his answer and this source.
there are multiple ways to use curl to upload image files, e.g.:
you can check the examples at: http://au.php.net/manual/en/function.curl-setopt.php
see http://docs.php.net/function.curl-setopt:
VolkerK is completely right but my experience suggest that sending a file "@" operator will only work with arrays.
Now you can send the file using
CURLOPT_POSTFIELDS