I have a table containing pictures URL that looks like this:
Table:
partno | url
10878 | http://www.pic1.jpg
20477 | http://www.pic2.jpg
and so on (+10000)
I want to run a script in order to download all of them on my LOCAL path
I was confusing what could be the most simple way to do it. I wanted to run a PHP script in order to get the URLs from MySQL and then use a PHP command to download each of them, something like this ...please help me
below .. i have done one by one download image by using textbox to search and download
// Open the file to get existing content
$data = file_get_contents($file);
$newimage=basename($file);
// New file
$new = 'image/'.$newimage;
// Write the contents back to a new file
file_put_contents($new, $data);
mysql_query("Insert into image set name = '$newimage' ");
echo "<img src='image/$newimage' width='300px' height='250px'/>";
}
?>
<form action="" method="post" enctype="multipart/form-data">
<input type="url" name="url"/><br/><br/>
<input type="submit" name="subimg" value="submit"/>
</form>
multiple image download from URL stored in database code..but output will not come..please help me
<?php
// connection to database
$con = mysql_connect("localhost","root","");
mysql_select_db('import_exceldata',$con)
?>
<?php
if(isset($_REQUEST['subimg']))
{
$result=mysql_query("select url from mytask ");
set_time_limit(1000);
while( $url = $result->fetch() ) {
// Open the file to get existing content
$data = file_get_contents($result);
$newimage=basename($result);
// New file
$new = 'image/'.$newimage;
// Write the contents back to a new file
file_put_contents($new, $data);
}
mysql_query("Insert into image set name = '$newimage' ");
echo "<img src='image/$newimage' width='300px' height='250px'/>";
}
?>
<form action="" method="post" enctype="multipart/form-data">
<input type="submit" name="subimg" value="retrieve images"/>
</form>