08-21-2009, 11:55 PM
|
#4 (permalink)
|
|
The Visitor
Join Date: Aug 2009
Posts: 2
Thanks: 0
|
Would you have any suggestions on how to do that ? I really am a noob with this. I have managed to get a bit further with a different script. Hers what I have for this version
Code:
<?php
mysql_connect('localhost', 'xxx', 'xxx');
mysql_select_db('pets');
$Dir = '.';
// Get a list of the files
if ($handle = opendir($Dir))
{
while ($file = readdir($handle))
{
$extension = strtolower(substr($file, -3));
if ($extension == 'gif')
{
// Load the file contents into the database
mysql_query("INSERT INTO image (name,size,type,content) VALUES ('$file', '$size($filename)', '$type', '" . addslashes(file_get_contents($Dir . "/" . $file)) . "');") or die(mysql_error());
}
}
}
else
{
die("Could not open directory: $Dir<br />");
}
?>
|
|
|
|