I'm creating a page for an IRC-channel, where users can add info about theirselves and some other things.
I want the uploaded image's new url (on my server) inserted into a database together with all other information.
Any ideas how to solve this? //Magnus
The issues involved are discussed in the last chapter of my PHP/MySQL article:
Handling File Uploads
Thanks alot Kevin
I think I know how to handle this =)
Kevin, This works just fine.. but there's one problem..
I want the url to my file linked.. not the path on my hd...
How do I do that?
You can either create the link with the image name and then insert it into the database or you can just store the image name and create the link to it when you need it.
Before inserting to database, if your file input field was named "userfile"
$imageurl = "http://www.yourdomain.com/images/".$userfile_name;
Then insert $imageurl into the db.
Or when you need to create the link on the other end, when displying data simply construct the url and tack on the image name form the db
$imageurl = "http://www.yourdomain.com/images/".$row["imagefield"];
That cat amazes me everytime :)