Welcome Guest, Not a member yet? Register   Sign In
Best place to put user uploaded files.
#2

(This post was last modified: 11-12-2022, 02:45 AM by davecoventry.)

Ok, this is what I'm doing.
In /public: preview.php
PHP Code:
<?php
 header
("Content-Type: image/bmp");
 
header("Content-Length: " filesize("/var/www/html/sites/example.com/writable/users/".$_GET['path']));
 
$fp fopen("/var/www/html/sites/example.com/writable/users/".$_GET['path'], 'rb');
 
fpassthru($fp);
?>
In my view.php file:
Code:
<img src="https://example.com/preview.php?path=<?php echo $userid;?>/image.bmp">
This is probably not best practice, but, security-wise, I can't see it being less secure than simply specifying the url of the image directly in the src of the img tag.
~ Dave
Reply


Messages In This Thread
RE: Best place to put user uploaded files. - by davecoventry - 11-11-2022, 11:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB