JonnySnip3r Posted August 7, 2010 Share Posted August 7, 2010 Hey guys i am making a php application and i have a feature where it allows members to upload images. If there a way to secure a folder to only be allowed access when a member is logged in and not someone accessing the folder and downloading images. Stuped question i know would it be better to store the images in the database as BLOB? but then again could make the database big. Thanks Link to comment https://forums.phpfreaks.com/topic/210091-using-php-to-secure-folders/ Share on other sites More sharing options...
void Posted August 7, 2010 Share Posted August 7, 2010 put .htaccess with deny from all in the image directory. then use a php file to retrieve images: <?php // image.php $name = str_replace(array('/', '\\'), "", $_GET['name']); $image = file_get_contents('images/' . $name); header("Content-type: image/jpg"); echo $image; exit(); ?> And then, in HTML: <img src="image.php?name=some_image.jpg" /> Link to comment https://forums.phpfreaks.com/topic/210091-using-php-to-secure-folders/#findComment-1096446 Share on other sites More sharing options...
JonnySnip3r Posted August 7, 2010 Author Share Posted August 7, 2010 Thanks dude!! Link to comment https://forums.phpfreaks.com/topic/210091-using-php-to-secure-folders/#findComment-1096458 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.