Ok I have php code that handles the upload of images. now I have remote post that handles this code:
$postheader = http_build_query($postarray);
$url = parse_url($uri);
$host = $url['host'];
$path = $url['path'];
$results = '';
if ($fp = fsockopen($host, 80, $errno, $errstr, 2))
{
stream_set_timeout($fp, 30);
$headers = "POST ". $path ." HTTP/1.0\r\n";
$headers .= "User-Agent: \r\n";
$headers .= "Host: ". $host ."\r\n";
$headers .= "Accept: */*\r\n";
$headers .= "Content-Type: application/x-www-form-urlencoded\r\n";
$headers .= "Content-Length: " . strlen($postheader) . "\r\n";
$headers .= "Connection: close\r\n\r\n";
@fputs($fp, $headers . $postheader);
while($currentHeader = fgets($fp, 4096))
{
if (preg_match("/^\r?\n$/", $currentHeader)) { break; }
}
while(!@feof($fp))
{
$results .= @fgets($fp, 1024);
}
@fclose($fp);
The thing is I get the url of the image from that post and it is stored like this:
$file = 'http://someurl.ll/image.jpg'
And script that handles image with: $_FILES['image']
Now if I can say $_FILES['image'] = $file it should go ferder, but it doesn't!
I thing that $_FILES['image'] needs not only url of data but also raw uploaded data
So I want to know what is equal to $_FILES['image'], that can can be make of $file = 'http://someurl.ll/image.jpg'?
UPDATE: Hier is what I got as $_FILES['image'] as var_dump
array(5) { ["name"]=> string(17) "logo.png" ["type"]=> string(9) "image/png" ["tmp_name"]=> string(14) "/tmp/phpWUqC5c" ["error"]=> int(0) ["size"]=> int(5674) }
an I want to make the same but from $file = 'http://someurl.ll/image.jpg' so the same array and then to say:
$_FILES['image'] = that array from http://someurl.ll/image.jpg
Because it is remote I would like to handle it as $_FILES['image'], but I cant so the quick solution is to make that remote image same as $_FILES['image']
fopen, as in:$_FILES['image'] = fopen($file,'r');? But indeed, its is not very clear what you want. – Sjors Branderhorst Dec 17 '12 at 12:19