IMAGE UPLOAD grrrrr >.<

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xiann
    New Member
    • May 2012
    • 1

    IMAGE UPLOAD grrrrr >.<

    what's wrong or missing ??

    Code:
    <?php
    if ((($_FILES["file"]["type"] == "image/gif")
    || ($_FILES["file"]["type"] == "image/jpeg")
    || ($_FILES["file"]["type"] == "image/pjpeg"))
    && ($_FILES["file"]["size"] < 80000))
     
      {
      if ($_FILES["file"]["error"] > 0)
        {
        echo "Error: " . $_FILES["file"]["error"] . "<br />";
        }
      else
        {
    
        if(isset($_POST['submit']))
        {
        echo "Upload: " . $_FILES["file"]["name"] . "<br />";
        echo "Type: " . $_FILES["file"]["type"] . "<br />";
        echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
        echo "Stored in: " . $_FILES["file"]["tmp_name"];
    
        
        echo "<br/><br/><br/><br/><br/><br/>";
        echo "<html><body><center>";
        print '<IMG SRC="$_FILES["file"]["name"]" WIDTH="250" HEIGHT="176" BORDER="0"
        ALT="">';
        echo "</center></body></html>";
    
        
        
        }
        }
      }
    
    ?> 
    <center>
    <form action="<?php $_SERVER=$_POST['PHP_SELF']; ?>" method="post"
    enctype="multipart/form-data">
    Change Picture
    <br>
    <input type="file" name="file" id="file" />
    <br />
    <input type="submit" name="submit" value="Submit" />
    </form>
    </center>
    Last edited by PsychoCoder; May 9 '12, 05:42 PM. Reason: Code tags added
  • PsychoCoder
    Recognized Expert Contributor
    • Jul 2010
    • 465

    #2
    First start with telling us what error you're getting, that will help us help you.

    Comment

    Working...