My idea was to have a single upload form that posts to the same page, so that a user could upload as many images as they wanted. As a file is uploaded, it is processed and a thumbnail of it appears in a list with all the other pictures, complete with options and such.
Only problem is, when I upload an image, the image gets printed (not as an image, but the gibberish seen when opening the file in notepad) on the top of the page. I've searched on google for a while and I have yet to find how to fix it.
I'm running (local server on Windows XP Pro x64):
Apache 2
PHP 5
Any suggestions?
PHP File Upload Question
In the php file that displays an image, you need to do a header('Content-Type: image/gif'); or image/jpeg or whatever is appropriate before outputting the contents of the image.
You can't just output the data from a bunch of images into an HTML file. You need to output something like <img src="get_thumbnail.php?picture=001"> and then get_thumbnail.php is responsible for outputting the content-type header and fpassthru-ing (or however else you want to do it) the image.
You can't just output the data from a bunch of images into an HTML file. You need to output something like <img src="get_thumbnail.php?picture=001"> and then get_thumbnail.php is responsible for outputting the content-type header and fpassthru-ing (or however else you want to do it) the image.