Php Help Please

Discussion in 'Gaming' started by White B O I, Sep 20, 2007.

  1. White B O I

    White B O I Well-Known Member

    Age:
    34
    Posts:
    813
    Likes Received:
    0
    Joined:
    Apr 11, 2006
    Location:
    Table Town, Arizona
    Well I got a website for no apparent reason and I'm fairly (really really) new to php :D

    i was reading a tutorial on how to make and upload script that goes like this
    Heres is my forum with the browse and submit and whatnot
    Code:
    <html>
    <body>
    
    <form action="uploader.php" method="post"
    enctype="multipart/form-data">
    <label for="file">Filename:</label>
    <input type="file" name="file" id="file" /> 
    
    
    <input type="submit" name="submit" value="Submit" />
    </form>
    
    </body>
    </html>
    and here is the actual uploader.php code
    Code:
    <?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"] . "
    ";
        }
      else
        {
        echo "Upload: " . $_FILES["file"]["name"] . "
    ";
        echo "Type: " . $_FILES["file"]["type"] . "
    ";
        echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
    ";
        echo "Temp file: " . $_FILES["file"]["tmp_name"] . "
    ";
    
        if (file_exists("upload/" . $_FILES["file"]["name"]))
          {
          echo $_FILES["file"]["name"] . " already exists. ";
          }
        else
          {
          move_uploaded_file($_FILES["file"]["tmp_name"],
          "uploads/" . $_FILES["file"]["name"]);
          echo "Stored in: " . "uploads/" . $_FILES["file"]["name"];
          }
        }
      }
    else
      {
      echo "Invalid file";
      }
    ?>
    I get this error when uploading something
    Code:
    Upload: 5.jpg
    Type: image/jpeg
    Size: 12.8759765625 Kb
    Temp file: /tmp/phpZvHLqY
    
    [B]Warning[/B]:  move_uploaded_file(uploads/5.jpg): failed to open stream: No such file or directory in [B]/home/www/xxxxxxx/uploader.php[/B] on line [B]25[/B]
    
    [B]Warning[/B]:  move_uploaded_file(): Unable to move '/tmp/phpZvHLqY' to 'uploads/5.jpg' in [B]/home/www/xxxxxxx/uploader.php[/B] on line [B]25[/B]
    Stored in: uploads/5.jpg
    what seems to be the problem


    NOTE: I crossed out my website for personal reasons
     
  2. Phili G

    Phili G Well-Known Member

    Age:
    33
    Posts:
    1,498
    Likes Received:
    0
    Joined:
    Oct 5, 2005
    Location:
    England!
    does your uploads folder exist?
     
  3. White B O I

    White B O I Well-Known Member

    Age:
    34
    Posts:
    813
    Likes Received:
    0
    Joined:
    Apr 11, 2006
    Location:
    Table Town, Arizona
    yes it does

    except i just figured out my problem

    Php is case sensitive and my uploads folder is Uploads not uploads, im not going to try it because i found a script that works

    thanks though
     

Share This Page