Displaying jpeg from temp dir
Posted: Tue Oct 25, 2005 11:40 pm
Hi all!
I'm building a site where the user inputs various text data into a form. Also they browse for some pics (jpegs) and the whole lot is submitted to a script called review.php.
On this page the information they have submitted on the previous page is displayed as a completed ad (it's a car ad site). If the user is happy with how the ad looks they hit submit and the data is uploaded to a mysql db.
However the problem I have is displaying the images on this preview page. Obviously at this point the images have not been uploaded to the db so I can't run a script to get/display the image from a db quiery. At the point the preview.php script runs the image data is held in the server /tmp folder so I was under the impression I could just access this data however I'm having no luck. I'm using the simple img src= string to display the image. My plan was if I could just point the src= to the /tmp location of the file then all would be ok. The code is as follows...
src="<?echo $_FILES['img1']['tmp_name']?>
When the page is displayed, right clicking on the image box shows a path of http://www.mysite.co.uk/tmp/file which to my mind is correct. The question is can you read from the tmp folder in this way???
Also the /tmp folder on my server is not in my /httpdocs folder so I'm just wondering whether this dir is even accessable through a browser in the first place.
Thanks in advance!
I'm building a site where the user inputs various text data into a form. Also they browse for some pics (jpegs) and the whole lot is submitted to a script called review.php.
On this page the information they have submitted on the previous page is displayed as a completed ad (it's a car ad site). If the user is happy with how the ad looks they hit submit and the data is uploaded to a mysql db.
However the problem I have is displaying the images on this preview page. Obviously at this point the images have not been uploaded to the db so I can't run a script to get/display the image from a db quiery. At the point the preview.php script runs the image data is held in the server /tmp folder so I was under the impression I could just access this data however I'm having no luck. I'm using the simple img src= string to display the image. My plan was if I could just point the src= to the /tmp location of the file then all would be ok. The code is as follows...
src="<?echo $_FILES['img1']['tmp_name']?>
When the page is displayed, right clicking on the image box shows a path of http://www.mysite.co.uk/tmp/file which to my mind is correct. The question is can you read from the tmp folder in this way???
Also the /tmp folder on my server is not in my /httpdocs folder so I'm just wondering whether this dir is even accessable through a browser in the first place.
Thanks in advance!