4 Replies - 1649 Views - Last Post: 23 October 2011 - 05:05 PM Rate Topic: -----

#1 marlborosounds  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 25-November 07

Multi image upload and query without database

Posted 23 October 2011 - 01:45 PM

Hello People,
Im trying to figure out how to make this code work for multi image upload and query. Im floating around on a boat in the pacific so im limited on internet and try to work on my website when I can. So Im not able to search volumes of information on this subject. :stupid: :stupid: If anyone can please help. :eek: :eek:
Cheers and thank you in advance.
?
session_start();
$n=$_FILES['user_file']['name'];
$type=$_FILES['user_file']['type'];
$size=$_FILES['user_file']['size'];
$time=time();
$n=$time;
$path="./mymess/uploads/". $n;




$uploaded = $_SESSION['firsttimeupload'];

if ($uploaded == "ok")
{
       if ($size <100000 && ereg("image", $type  ))
          {
			move_uploaded_file($_FILES['user_file']['tmp_name'],
			$path);
			
			$root= "http://wwww.mymess/mymess/uploads/";
			$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'></img>";
			echo "<center>";
			
			
			$fp=fopen("links.text", "at");
			fwrite($fp, $path2."\n");
			fclose($fp);
			session_destroy();
          }		  
}	  
else
{
echo "you cant 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";
       }

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



Is This A Good Question/Topic? 0
  • +

Replies To: Multi image upload and query without database

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10809
  • View blog
  • Posts: 40,294
  • Joined: 27-December 08

Re: Multi image upload and query without database

Posted 23 October 2011 - 01:49 PM

What specific problems or errors are you encountering?
Was This Post Helpful? 0
  • +
  • -

#3 marlborosounds  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 25-November 07

Re: Multi image upload and query without database

Posted 23 October 2011 - 02:08 PM

Good Day,

Im trying to add a extra image uploads and query those images on a seperate page in thumbnails but so far all I get is error msgs.

So im trying to figure out how to query with this code each picture from this.
<form action="upload.php"  enctype="multipart/form-data"
method="POST">
  <p>Select a file: 
    <input type="file" name="user_file[1]" size="50">
    <input type="file" name="user_file[2]" size="50">
    <input type="file" name="user_file[3]" size="50">
      <br />
      <br />
      <input type="submit" name="submit" value="Upload Now" />
</p>
</form>


So im trying to make this work with this;
<?
session_start();
$n=$_FILES['user_file']['name'];
$type=$_FILES['user_file']['type'];
$size=$_FILES['user_file']['size'];
$time=time();
$n=$time;
$path="uploads\\". $n;




$uploaded = $_SESSION['firsttimeupload'];

if ($uploaded == "ok")
{
       if ($size <100000 && ereg("image", $type  ))
          {
			move_uploaded_file($_FILES['user_file']['tmp_name'],
			$path);
			
			$root= "http://localhost/uploadingprog/uploads/";
			$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'></img>";
			echo "<center>";
			
			
			$fp=fopen("links.text", "at");
			fwrite($fp, $path2."\n");
			fclose($fp);
			session_destroy();
          }		  
}	  
else
{
echo "you cant 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";
       }

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

Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10809
  • View blog
  • Posts: 40,294
  • Joined: 27-December 08

Re: Multi image upload and query without database

Posted 23 October 2011 - 02:11 PM

Quote

but so far all I get is error msgs.

If you don't tell us what errors you are encountering, we are the blind leading the blind. :)
Was This Post Helpful? 0
  • +
  • -

#5 marlborosounds  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 25-November 07

Re: Multi image upload and query without database

Posted 23 October 2011 - 05:05 PM

G'day Macosxnerd,

I get this msg when i hit the submit button , this comes up on the process form. ERROR
the image size is too bigERROR
the file is not image

This is my form that I submit with
<form action="upload.php"  enctype="multipart/form-data"
method="POST">
  <p>Select a file: 
    <input type="file" name="user_file[1]" size="50">
      <br />
<input type="file" name="user_file[2]" size="50">
      <br />
<input type="file" name="user_file[3]" size="50">
<br />

      <input type="submit" name="submit" value="Upload Now" />
</p>
</form>



And this what im trying to make work, but i just seem not to get it. once i see i understand,.
<?
session_start();
$n=$_FILES['user_file']['name'];
$type=$_FILES['user_file']['type'];
$size=$_FILES['user_file']['size'];
$time=time();
$n=$time;
$path="upload/". $n;




$uploaded = $_SESSION['firsttimeupload'];

if ($uploaded == "ok")
{
       if ($size <100000 && ereg("image", $type  ))
          {
			move_uploaded_file($_FILES['user_file']['tmp_name'],
			$path);
			
			$root= "http://www.blahblah.com/form/upload/";
			$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'></img>";
			echo "<center>";
			
			
			$fp=fopen("links.text", "at");
			fwrite($fp, $path2."\n");
			fclose($fp);
			session_destroy();
          }		  
}	  
else
{
echo "you cant 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";
       }

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

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1