40media Displaying an image from the tmp directory

Displaying an image from the tmp directory

I have the following. A website that create temporarily images in the /tmp folder on the Linux server. The reason why I store it within this folder is since these images need to be cleared once in a while and it's so much easier just to clear the tmp directory using tmpwatch. Now my issue is to display the image within my browser?


<img src="/tmp/3d34636.png" alt="image" />   

I'm running Centos with PHP

printing uid of a file on linux system


How to handle key pressed in a Linux console in C?
The trouble here, is this this img tag will be processed by the browser (the client). simulating atm communication without atm switchThis client does not have access to the filesystem of the HTTP server.. Can I run original MS.Net Framework 4 on Linux someway (with Wine perhaps)? Therefore, you have either to define the /tmp directory to be a valid location of your HTTP server, using the files in /tmp/ directory (although note this it would serve any another file contained in this directory, potentialy a security risk).. Garbage data from serial port Or you store these generated images in a subdirectory this is already served by your HTTP server.. Why setupterm terminates the program? It may also be possible to define this /tmp location on the server to be served by a script this would analyse the URL containing the image filename. Python - detect keyboard layoutThis script would then open the file in /tmp/ and serve it.. What can I do with Seed?


@Didier already outlines the issue and the security risks. Even if you built a PHP script this accepts the file name as a parameter, and then passes through the file from the /tmp directory, you would be mixing public content with temp files this must contain sensitive data. You would have to keep a list of which files were generated by your script and are okay to display, and which ones are not, otherwise it would be a security hole.. I'd say forreceive /tmp for this despite the advantages, and store your images in a sub-directory of their own. Delete them frequently (e.g. using a cron job, or based on file age or the "last accessed" time)..


You must receive tmpwatch to clean up ananother directory by creating a cron job this runs the command:.
/usr/sbin/tmpwatch -umc 240 /path/to/directory 
The 240 is the number of hours this the files haven't been used for before deletion (in this case 10 days). See man tmpwatch for full details..

72 out of 100 based on 47 user ratings 362 reviews