php,image download -


When users upload the image, I save it in the image folder in the htdocs directory. Therefore, without entering the site, a user will get the url / images / "name" type. What is the best way to prevent this as the browser only requests that users are typing directly on the image in the address bar? I was thinking about using a script to download every image file from a directory after checking session details. Do you think it would be a good attitude if you could recommend me a script I do not want to use the database I think it will slow down or tell me if this is a better way.

THnks

You can place it outside the htdocs / directory, and Images DDIR / Image So URL / image / test.jpg image .php? Path = test.jpg

image.php Something like this might appear:

  & lt? Php if ($ log in) {header ("content-type: image / JPEG"); Echo file_get_contents ("../ images /".$_GET [" path "]); }? & Gt;  

Do not forget to clean the input! You do not want the user to access arbitrary files.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -