I want to upload an external image to my remote host via php.mean's that i wan't code which copy http://www.exaple.com/123.jpg to http://www.mysite.com/image.jpg. Despite exec function ,due this function has been disabled by webhosting. best regards
Google is your friend:
<?php exec("wget http://www.exaple.com/123.jpg"); exec("mv 123.jpg image.jpg")?>
(this code is to be executed on the server www.mysite.com)
You can run a php script to get the file and save it in your site.
<?php
$data = file_get_contents('http://www.exaple.com/123.jpg');
if ($data !== false) {
file_get_contents('image.jpg', $data);
}
else {
// error in fetching the file
}
file_get_contents
is binary safe. you can find more about it from php website http://php.net/manual/en/function.file-get-contents.php