1. Home
  2. Computing & Technology
  3. PHP / MySQL
photo of Angela Bradley
Angela's PHP / MySQL Blog

By Angela Bradley, About.com Guide to PHP / MySQL

MySQL Record of Images

Tuesday May 30, 2006
Recently qamarulhuda posted in our forum:

"I know how to submit data into a mySQL table through a form. Now I want to upload the image file to the remote directory (say, 'images/') but at the same time save the file-name in the table."

This is a very good way to keep track of uploads. You can associate a file with a user in the database, but not bog things down by saving the file directly into the database. We have tutorials about uploading files, and about adding data from forms. We just need to combine these concepts together, and have it do both things. Our new tutorial gives a demonstration of how to do this.
Comments
August 27, 2006 at 2:35 pm
(1) Tiago Schardong says:

Hello Angela,

Im Tiago and Im from Rio de janeiro, Brasil. Im trying to learn about php & MySQL and your tutorials are very helpful tanks for that!

Im having a problem in the “Upload a File and write to MySQL” tutorial. Im checked the path and my password many times and i keep having the message “permision denied”. The complete message is:

________________________________________________

“Warning: move_uploaded_file(img/Photo 116.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/restricted/home/schardongdesign/public_html/add.php on line 21

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/home/restricted/home/schardongdesign/tmp/phpUsn37o’ to ‘img/Photo 116.jpg’ in /home/restricted/home/schardongdesign/public_html/add.php on line 21
Sorry, there was a problem uploading your file.

________________________________________________

If you have an idea about what am I doing rong please tell me!

Tanks!

July 21, 2008 at 6:27 am
(2) Gareth Jones says:

Hi Tiago,

Your file permissions must be wrong they need setting to 777. This is relatively easy to do if you use an FTP client e.g. Cyberduck or Transmission simply right mouse click on the “uploads” folder and change the settings to read/write/modify for all e.g. 777.

Hope this helps.

Thanks

Gareth Jones

February 19, 2009 at 4:47 am
(3) sisira says:

hello freind,

i used the above coding to upload a file to a serer and enter data to a data base. The file uploading happens perfectly. But the data didnt go to the data base. what might be wrong?

Untitled Document

October 22, 2009 at 1:26 pm
(4) SouthWind21 says:

Printing their garbage to buy up the planet and make us their slaves. ,

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Discuss
Community Forum
Explore PHP / MySQL
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL

©2009 About.com, a part of The New York Times Company.

All rights reserved.