Search the web
Sign In
New User? Sign Up
phpexperts
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
how can i upload image and display in php   Message List  
Reply | Forward Message #10805 of 13330 |
HTML form for uploading files:

<html>
<body><form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form></body>
</html>

upload_file.php
--------------------
<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 20000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if
(file_exists("upload/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
?>




This is a code to upload image but how can i display the uploaded
image in php site.pls anyexperts can give profer solution?




Tue Jan 6, 2009 5:48 pm

sagar_niit2005
Offline Offline
Send Email Send Email

Forward
Message #10805 of 13330 |
Expand Messages Author Sort by Date

HTML form for uploading files: <html> <body><form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> ...
sagar_niit2005
Offline Send Email
Jan 6, 2009
6:14 pm

For displaying the image you'lll have to print the image binary data after a header call. The headers will declare the MIME type and size of the image. I'll...
9el
ghazilenin
Offline Send Email
Jan 6, 2009
6:23 pm

there are many way display images you can use greybox, lightbox. those are very nice way to display image. very simple and opensource. hope you will enjoy....
shanto sas
saeedmail
Offline Send Email
Jan 6, 2009
6:31 pm

to show the uploaded image, u can user this header code: header("Content-type: image/png");//image/png OR image/jpeg ... and after that u need to get the...
hell_lord_1988_ch
hell_lord_19...
Offline Send Email
Jan 6, 2009
7:50 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help