I have multiple jpg image files on our server that I am trying to download to my pc. They are each listed in our database with a path, a title, id, type location found (among other identifiers). I am trying to download them to directories/sub-directories of location and type for organization purposes.
file_get_contents($path) works, but file_put_contents($destination) puts the images in the server directory the webpage is in, not the local pc path that I pass to it.
Can someone tell me what I am doing wrong (I'm sure that list is long!).
Here is my code:
// $Image is the array of images with the associated data
$TempGet = file_get_contents($absolutepath); //this seems to work
$TempPut = "C:\Images\\" . $Image["il_name"] . "\'" . $Image["it_name"];
$TempPut .= "'\'" . $Image["title"] . "-" . $Image["pictureid"] . ".jpg'";
$Result = file_put_contents($TempPut, $TempGet);
$absolutepath is "var/www/images/32456.jpg"
$TempPut ends up as "C:\Images\A\'Red Zone'\'3rd one on left-32456.jpg'
Why is it putting the image on the server and not on my pc? Thank you.
EDIT: I don't want the pop-up window asking where to save the file; I wanted to be able to download 1000's of images in an organized manner automatically. Sorry to have left that out. Thanks