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
Share on other sites

I have tried storing them in BLOB's but to no success, i dont know how to store them on the server then point it to a users account. Sorry not very helpful am I !!

 

I can upload a file to the server but i can't attach it to a users profile

Link to comment
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_.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.