what is the best way to creat user album with php and mysql?

numey A

New member
Here what I think,
A user have a table named username_images
so, when he upload his image to a file on the web, the file will have a unique name
generated by php script,

$uid_h=uniqid('anyword');

so, what happens when he upload the image using a form from html
is the code will assign a uniqe ID for the image.

and save it on a database
say I have a table

username_iamges

num | type | ID
0 | JPG | bnbdkjhw
1 | GNP | bemwbnvb


So, when the user goes to his album the PHP will fetch those table
and use some way to connect them. and it will apears.


Ok, I didn't try this but I worked with similar example like this and it works.

so, I need your opinion

1- is this the best way? secure?
2- is it actually how most people does this?
3- is it better to upload the image to file than to database?

if u think uploading the image to database is better, please tell me why?
and also, how ? give me a link.


If you think that the way I'm planing to do this is good and not bad then please help me accomplish these two steps.

1- how to create a file on my website for the user, say the user clicks on(create new album) but only works once.
the albume goes inside (images/user-ID/image.JPG

2-How can I delete the image from the folder?
I know how to delete the information and drop it from the folder. but I don't know how
to delete it from the folder.


Finallly, this is not important. how can I secure the images that you must be signed in to see them

say
mywebsite,net/profiles/images/my_image/me.jpg

if any person use the URL the image will shown up. how to secure and locked it?

thank you.
 
Back
Top