Hi peoples,
Im new to all of this and im trying to learn this. I have found a script for picture upload to a database with a picture query.
Im trying to find out if there is a way to make this script into an array so I can upload say 3 pictures and view at once.
Thank you in advance
here is the code:
<?
session_start();
include("config.php");
$n=$_FILES['user_file']['name'];
$type=$_FILES['user_file']['type'];
$size=$_FILES['user_file']['size'];
$time=time();
$n=$time;
$path="uploads\\". $n;
$uploaded = $_SESSION['firsttime'];
if ($uploaded== 'ok')
{
if ($size<100000 && ereg("image", $type) )
{
move_uploaded_file($_FILES['user_file']['tmp_name'],
$path);
$path2=$root . $n;
echo "<center>";
echo "<h3>Your Image Link Is: </h3><a href=$path2>$path2</a><br><br>";
echo "<br>";
echo "<img src=$path2 border='5' height='100' width='100'></img>";
echo "<center>";
$link=mysql_connect($data_server, $data_user, $data_pw)
or die("couldnt connect to database");
mysql_select_db("upload") or die("Could not select database");
$query = "INSERT INTO image_table SET image = '$path2' ";
$result = mysql_query($query);
session_destroy();
}
}
else
{
echo "you couldnt upload the same image many times per session go back and choose it or another one";
}
////////////
if ($size>100000)
{
echo "ERROR <br> the image size is too big<br>";
}
if (!ereg("image", $type) )
{
echo "ERROR <br> the file is not image<br>";
}
echo"<br><br><h2><a href='library.php'>View Images Library</a></h2>";
echo "<body bgcolor='#FF6699'>";
?>