0

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


?>

Edited by Nick Evan: Fixed formatting

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by marlborosounds
0

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.

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.