How to upload an image, save it on the server and store its?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Betty_S
Forum Newbie
Posts: 20
Joined: Tue Dec 05, 2006 3:40 am

How to upload an image, save it on the server and store its?

Post by Betty_S »

Hallo everyone!

I wont to add php/html code which can do that:

Let the user choose and upload a file (an image), save the file on the server and store its location into a mysql table.

If you have an example code or a link that would be super!

I know how to handle the html part but I have no idea whatsoever what to do with the path I get from the user!

Please help me.

Thanks.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

The information is stored in $_FILES["your-form-field-name"] once the file has been uploaded.

Use move_uploaded_file() to move it where you want, then add that to the DB.

http://uk.php.net/manual/en/features.file-upload.php
Post Reply