Jump to content

multi-Image upload


emediastudios

Recommended Posts

Hi all.

I have a code that works fine except for one thing, it only uploads (1) image and i want to upload (4).

the code i have does all ehat i want and inserts the file name in to my SQL database along with some other info.

Can someone tell me how to alter my code to upload (4)images, and record there image name into sql.

the code i have below i altered to process (3) pics but it doesnt upload the images and  only inserts there image file name into sql.

 

 

Thanks so much........... ;)

Heres the code i have

 

<?php

 

//This is the directory where images will be saved

$target = "../images/";

$target = $target . basename( $_FILES['photo']['name']);

 

 

//This gets all the other information from the form

$name=$_POST['name'];

$suburb=$_POST['suburb'];

$price=$_POST['price'];

$content=$_POST['content'];

$pic=($_FILES['photo']['name']);

$pic2=($_FILES['photo2']['name']);

$pic3=($_FILES['photo3']['name']);

 

 

// Connects to your Database

mysql_connect("localhost", "root", "5050888202") or die(mysql_error()) ;

mysql_select_db("gcproperty") or die(mysql_error()) ;

 

//Writes the information to the database

mysql_query("INSERT INTO `employees` VALUES ('$name', '$suburb', '$price', '$content', '$pic', '$pic2', '$pic3')") ;

 

//Writes the photo to the server

if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))  --------------My problem needs to sorted here somewhere i think.

{

 

//Tells you if its all ok

print "<meta http-equiv=\"refresh\" content=\"0;URL=property_added_successfully.php\">";

}

else {

 

//Gives and error if its not

echo "Sorry, there was a problem uploading your file.";

}

?>[/color]

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.