Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Upload with Filename

Status
Not open for further replies.

sbayter

IS-IT--Management
Nov 14, 2002
95
CO
Hi,
I need to create a form which contains some information about the person and which can handle 5 file uploads.
I need the files to be saved into a folder and the other information and the filenames get saved into a mySQL db.
I did it in ASP using some software but now I need to convert it to PHP and without any software.
Any help ?
Thanks in advance,


sbayter
 
Obviously this may need to be looped...


if(isset($_POST['userfile'])) { // file sent by form

$type=$HTTP_POST_FILES['userfile']['type'];

$file_realname = trim($HTTP_POST_FILES['userfile']['name']);
$uploaddir = "/var/web/upload/"; // upload directory


if (move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'], $uploaddir . $file_realname)) {

// done now, change mysql and update with filename

$query="INSERT into data filename=\"$file_realname\"";
mysql_query($query);
}
}

etc etc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top