Jump to content

Upload files and store location in database


Guest

Recommended Posts

Hi there,

 

I was wondering if there was a good way to upload files (like images, videos or sounds) somewhere in my website and store the location of the files into a database.

 

I was starting to work on the "images" part of this and was about to store the files into my database but then I thought that might be a good idea because of the number of images and size it would be in the end.

 

Anyone came up with the same issue?

It's simple, take the basename and insert that into a table under the column name. Then use mysql_insert_id to get the ID of that file, and move_uploaded_file($_FILE['File'], "images/" . mysql_insert_id() . basename($_FILE['File']));

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.