PDA

View Full Version : multiple uploads


gavimobile
09-16-2008, 09:55 PM
ok this should be a really easy one!

i want to upload a pdf file and gif file with my form.. the gif i created and its working fine,
before i ruin my script i need a little support.
$prosp_l2 is my gif var which is working
$prosp_l is my pdf var which i havent started yet.

my hypotesis is that in $target i need to add $_FILES['prosp_l']['name']
and with move_uploaded_file function i need to add $_FILES['prosp_l']['tmp_name']
im just not sure how to add them. && maybe?
this script doesnt need to limit the size of the photo or file, or check the file type.
nothing to complex, lux i know youll have some cool suggestions for me, and ill love to hear em!

tia guys


<?php
require_once('../includes/config.inc.php');

//This is the directory where images will be saved
$target = "../images/prospects/";
$target = $target . basename( $_FILES['prosp_l2']['name']);

// variables must be filled
if ($submit && $prosp_t && $prosp_n && ! $update_id){

// Insert Query
mysql_query("INSERT INTO prospects (prosp_title, prosp_lang, prosp_date, prosp_loc, prosp_loc2, prosp_num) VALUES ('$prosp_t', '$prosp_g', '$prosp_d', '$prosp_l', '$prosp_l2', '$prosp_n')");

// upload file start
if(move_uploaded_file($_FILES['prosp_l2']['tmp_name'], $target)) {
}

}elseif($submit && $update_id){

mysql_query("UPDATE prospects set prosp_title='$prosp_t', prosp_lang='$prosp_g', prosp_loc='$prosp_l', prosp_loc2='$prosp_l2', prosp_num='$prosp_n' WHERE prosp_id = '$update_id' ");
}
?>

lux
09-17-2008, 12:53 PM
i assume you are posting the form? if you are then repeat the process you use for the first file upload.

gavimobile
09-17-2008, 05:27 PM
i assume you are posting the form? if you are then repeat the process you use for the first file upload.
i wasnt exactly sure how to do it, meaning was i supose to rerun the if statement or just ad && with the var name after.

i stoped being lazy and thought it out.
i reused the if statement and make a new target var for my second upload.

worked like a charm

thanks lux

please mark SOLVED !!

jewelice
09-17-2008, 08:08 PM
hi. I m a new member of this forum. i don't how to proper use forum.plz help me.

domedia
09-17-2008, 09:45 PM
jewelice:
http://www.dreamweaverclub.com/forum/faq.php

And welcome to the forums!