Jump to content

MySQL Image Upload/retrive


webtech123

Recommended Posts

Im in desperate need of help, Ive been downloading scripts for ages now and can't find a single one to do what i want it to do!!!!!!  I just need a user to be able to upload a images (10) then retrive them by way of their user id.

 

This is the only piece of php/mysql that ive ever got stuck with, can someone please help?

 

Regards,

James

Link to comment
https://forums.phpfreaks.com/topic/110954-mysql-image-uploadretrive/
Share on other sites

Do not store them in the database.  That's a complete waste of time and DBMS resources.

 

When you upload them to the server, simply append an ID to the front of the filename: 1234_pic_of_my_dog.jpg

 

Then you have a table in the database like this:

 

user_id | media_id

1          1234

1          2345

2          8942

 

etc.

 

Then when you need to display them, simply get all the ids for the user out of the table and go retrieve all the files that start with media_id_.

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.