Jump to content

Archived

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

corillo181

[SOLVED] file privacy

Recommended Posts

lets say i have a folder for ppl to upload picture and then be able to view only their pictures..

but you know when you look at a picture url it gives out where the picture is located and if the user remove the photo name they go derectly to the directory and are able to see all the pictures in it.. how can this be aviod..

and if is pissible how do i change the name of the file been uploaded.. i traid rand()=num.$name.. but this only adds the amount of numbe ri want to the file and keeps the same name.. i want to change the whole name..


thanx for any one who help me with this..

Share this post


Link to post
Share on other sites
[!--quoteo(post=374278:date=May 16 2006, 04:05 PM:name=Richard181)--][div class=\'quotetop\']QUOTE(Richard181 @ May 16 2006, 04:05 PM) [snapback]374278[/snapback][/div][div class=\'quotemain\'][!--quotec--]
but you know when you look at a picture url it gives out where the picture is located and if the user remove the photo name they go derectly to the directory and are able to see all the pictures in it.. how can this be aviod..
[/quote]

add a index.php file. this file can be blank, or can redirect a user to your home page. That way, users can't get the contents of a directory, because the php file gets executed.

Share this post


Link to post
Share on other sites
nice :) and do you know how can i change a file entried name for uploading..

this only add to it..

$filename = $_FILES['ulfile']['name'];
$random=rand(0000,9999);
$newname=$random.$filename;

Share this post


Link to post
Share on other sites
are you going to store the new filenames into the db? maybe you can change the filename into USERID.PIC#

Share this post


Link to post
Share on other sites
[!--quoteo(post=374343:date=May 16 2006, 01:07 PM:name=ryanlwh)--][div class=\'quotetop\']QUOTE(ryanlwh @ May 16 2006, 01:07 PM) [snapback]374343[/snapback][/div][div class=\'quotemain\'][!--quotec--]
are you going to store the new filenames into the db? maybe you can change the filename into USERID.PIC#
[/quote]


yes it is both going to a database and a directory..

Share this post


Link to post
Share on other sites

×

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.