By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,278 Members | 1,329 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,278 IT Pros & Developers. It's quick & easy.

IMAGE UPLOAD grrrrr >.<

P: 1
what's wrong or missing ??

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if ((($_FILES["file"]["type"] == "image/gif")
  3. || ($_FILES["file"]["type"] == "image/jpeg")
  4. || ($_FILES["file"]["type"] == "image/pjpeg"))
  5. && ($_FILES["file"]["size"] < 80000))
  6.  
  7.   {
  8.   if ($_FILES["file"]["error"] > 0)
  9.     {
  10.     echo "Error: " . $_FILES["file"]["error"] . "<br />";
  11.     }
  12.   else
  13.     {
  14.  
  15.     if(isset($_POST['submit']))
  16.     {
  17.     echo "Upload: " . $_FILES["file"]["name"] . "<br />";
  18.     echo "Type: " . $_FILES["file"]["type"] . "<br />";
  19.     echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
  20.     echo "Stored in: " . $_FILES["file"]["tmp_name"];
  21.  
  22.  
  23.     echo "<br/><br/><br/><br/><br/><br/>";
  24.     echo "<html><body><center>";
  25.     print '<IMG SRC="$_FILES["file"]["name"]" WIDTH="250" HEIGHT="176" BORDER="0"
  26.     ALT="">';
  27.     echo "</center></body></html>";
  28.  
  29.  
  30.  
  31.     }
  32.     }
  33.   }
  34.  
  35. ?> 
  36. <center>
  37. <form action="<?php $_SERVER=$_POST['PHP_SELF']; ?>" method="post"
  38. enctype="multipart/form-data">
  39. Change Picture
  40. <br>
  41. <input type="file" name="file" id="file" />
  42. <br />
  43. <input type="submit" name="submit" value="Submit" />
  44. </form>
  45. </center>
May 8 '12 #1
Share this Question
Share on Google+
1 Reply


PsychoCoder
Expert Mod 100+
P: 465
First start with telling us what error you're getting, that will help us help you.
May 9 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.