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'>";


?>

Recommended Answers

All 3 Replies

Hi Freemacbee,
Thank you for the information. I looked at the pear script but im just lost looking at it all. I just need a way to upload 3 files to a folder on my server then generate 3 thumbnails. This script will show one but i need two more if its possible.

ooops sorry Feemacbee, had mistyped your name. Guess its from too much sun here on the Gold Coast.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.