Web Hosting Talk







View Full Version : [PHP] uploading a file from a web form


Omega-Mark
04-05-2005, 02:21 PM
Hello, I am using one of my own pre-made forms for input into an sql db and i know I can use this same one for a gallery system im making for my own site.. basically i want this to happen upload the file to a directory already defined as $dir (chmod to 0777 obviously) and I want my query for inserting to the db to grab the filename and the dir (in the query to file input is $file) so i want it to insert $url into the db as $dir/$filename uploading the file in the process.

all help is appreciated thanks in advance

$url obviously isnt defined yet.
require('config.php');
$sql2 = "insert into images
(title, gallery, url, description) values
('$title','$gallery','$url','$description')"; #create query
$result = @mysql_query($sql2,$conn)
or die("Could not execute query - check code settings"); #execute query
if($result) { echo("<meta http-equiv='refresh' content=0;url=gallery.php'>"); } is the code which will need to be edited.

mfonda
04-05-2005, 02:54 PM
The PHP manual is such a cool thing!
http://us4.php.net/manual/en/features.file-upload.php

Omega-Mark
04-06-2005, 12:06 PM
ya it's great however... I hate having to look through php.net to get my things soprted if someone could help me with the small snippet which would help me and which would be appropriate to my code is more helpful.