How to upload photos to the server by direct link?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
14 views
At the moment, have to zagruzat photo to his directorey and then send over new CURLFile(/my_direcroty), this function works with files that are on the server, propyme links not working(new CURLFile(www.site.ru/*.jpg)). Maybe someone knows how to make zakrutku URL?
Tried to do it through file_get_contents, but nothing comes out:
define('MULTIPART_BOUNDARY', '--------------------------'.microtime(true)); $header = 'Content-Type: multipart/form-data; boundary='.MULTIPART_BOUNDARY; define('FORM_FIELD', 'uploaded_file'); $filename = "https://thefancy-media-ec2.thefancy.com/original/20120819/167936702336205476_aa4d348f12c5.jpg"; $file_contents = file_get_contents($filename); $content = "--".MULTIPART_BOUNDARY."\\". "Content-Disposition: form-data; name=\\".FORM_FIELD."\\"; filename=\\".basename($filename)."\\"\\". "Content-Type: image/jpeg\\\\". $file_contents."\\"; $content .= "--".MULTIPART_BOUNDARY."\\". "Content-Disposition: form-data; name=\\"foo\\"\\\\". "bar\\"; $content .= "--".MULTIPART_BOUNDARY."--\\"; $context = stream_context_create(array( 'http' => array( 'method' => 'POST', 'header' => $header, 'content' => $content, ) )); $response = file_get_contents($uploadUrl, false, $context);

Any help would be appreciated!
by | 14 views

1 Answer

0 like 0 dislike
by

Related questions

110,608 questions
257,186 answers
0 comments
35,430 users