Awesome q2a theme

How to upload photos to the server by direct link?

0 like 0 dislike
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(*.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 = ""; $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 | 32 views

1 Answer

0 like 0 dislike

Related questions

110,608 questions
257,187 answers
40,796 users