well sorry i didnt really answer that very well, its been a long day
If it were me and i havnt really looked at the code,
but here
PHP Code:
// now let's move the file to its final location and allocate the new filename to it
@move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploadFilename)
or error('receiving directory insuffiecient permission', $uploadForm);
// If you got this far, everything has worked and the file has been successfully saved.
// We are now going to redirect the client to a success page.
header('Location: ' . $uploadSuccess);
I would add a mySQL insert script
like this
PHP Code:
// now let's move the file to its final location and allocate the new filename to it
@move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploadFilename)
or error('receiving directory insuffiecient permission', $uploadForm);
//in addition to Bokeh's script you can insert each record into a database.
$q = "INSERT INTO table_name (`filename`,`date`) VALUES ('$uploadFilename',$date(dMy))";
$s = mysql_query($q);
//if an error
echo(mysql_error());
// If you got this far, everything has worked and the file has been successfully saved.
// We are now going to redirect the client to a success page.
header('Location: ' . $uploadSuccess);
I suck at this. I'm more than a newbie, I'm a baby. I want to create a webpage that will allow a friend of mine to upload pictures using my website. I have read so much on formhandlers and php that now I am dizzy and even more confused. Is there someone out there that can help me make this webpage along with step by step instructions on how to impliment it. I use frontpage 2003. I also need it to be able to do multiple files. thank you
then dump frontpage and download bokehs multiple upload script and put it in your root dir. It will just work as long as you have php enabled on your server.
Would you like FTP view or showing results on web site?
I would like the results on the web site...more specifically to show on the page once uploaded.
I figured that it would have to go into a database, but I am a rookie at databases.
How would I get the pics that were uploaded to view on a page in real-time?
Harry Kerstetter
President
Tylivia Web Design Browser: Firefox 2 beta 2 Resolution: 1440 X 900 Development Tools:
Macromedia/Adobe Studio 8
Adobe Illustrator CS
SWiSH Max
PHP Designer 2005 Favorite Quote:"In completing one discovery we never fail to get an imperfect knowledge of others of which we could have no idea before, so that we cannot solve one doubt without creating several new ones." - Joseph Priestly, 1786
Refer to my post following toplisek's reponse. assuming you konw how to set up a database and have access to a mySQL database. Thats would be the first thing to check.
OK, the image uploads ok, now I want to stick the filename into an existing row field. I don't get an error and the redirect works after the upload. Also I don't want to insert the whole path just the filename, am I using $uploadFilename ?
My code is:
PHP Code:
// If you got this far, everything has worked and the file has been successfully saved.
// We are now going to redirect the client to the success page.
// But first add the image filename to the database
require_once('includes/connect.php');
$regid = $_SESSION['ladyid'];
$sql = "UPDATE femaleusers SET image = '$uploadFilename' WHERE id = '$regid'";
header('Location: ' . $uploadSuccess);
$regid holds the correct value and so does $uploadFilename as I echo'd them out to test.
Many thanks if anyone can shed some light on this!
as Bokeh said, You need to run the query before sending them away with a header request.
PHP Code:
// If you got this far, everything has worked and the file has been successfully saved.
// We are now going to redirect the client to the success page.
// But first add the image filename to the database
require_once('includes/connect.php');
$regid = $_SESSION['ladyid'];
$sql = "UPDATE femaleusers SET image = '$uploadFilename' WHERE id = '$regid'";
mysql_query($sql);//run the query
echo(mysql_error));//echo any errors
header('Location: ' . $uploadSuccess);
$_SESSION['ladyid']; ?? what are you building? a porn site?
Sorry, my mistake when typing... more like C:/blah/file.jpg
mysql_query($sql);//run the query
echo(mysql_error));//echo any errors
header('Location: ' . $uploadSuccess);
I've now got the query running, if I put echo(mysql_error));//echo any errors in there I get an error with header('Location... saying header already sent... anyway it DOES now insert the filename in the correct field in the db but I have the whole upload path, I just want file.jpg but couldn't see what variable to use instead of $uploadFilename.
$_SESSION['ladyid']; ?? what are you building? a porn site?
Hehe... nope, not quite.. its a site for introductions more than anything... the ladies are all Thai.
Bookmarks