CliffLandin
Programmer
I need to copy around 7,000 images from a site to my computer. I have a csv file with the image names and the path to the images.
I have tried using this...
but this creates empty images, I believe because file returns an array.
I'm sure that there is some way to go about this, but I really don't know what that might be.
When in doubt, go flat out!
I have tried using this...
Code:
<?php
$urlPath = "[URL unfurl="true"]http://pathtoimages/";[/URL]
$csvFile = "nameof.csv";
$cnt = 0;
$openCSV = fopen($csvFile, "r");
while (($data = fgetcsv($openCSV, 1000, ",")) != false){
$fileName = $data[ 7 ];
$imagePath = $urlPath.$fileName;
$image = file($imagePath);
$newImage = fopen($fileName, 'wb');
fwrite($newImage, $image);
fclose($newImage);
}
?>
but this creates empty images, I believe because file returns an array.
I'm sure that there is some way to go about this, but I really don't know what that might be.
When in doubt, go flat out!