Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    Join Date
    Nov 2007
    Posts
    753
    Tokens
    0

    Default I keep getting this error...

    Im making my first php script so bare with me! every time i try and upload an image it keeps saying that the file is too big! but it isnt!
    can anyone spot the error in my code?

    Code:
    <html>
    <head>
    <title>YOURSITE.com - Image Upload By Forge</title>
    </head>
    <body>
    <form action='index.php' method='post' enctype='multipart/form-data'>
    Browse a File to Upload:<br>
    <input type='file' name='filetoupload'><br>
    <input type='hidden' name='max_image_size' value='<?echo $sizelimit; ?>'>
    <br>
    <input type='Submit' value='Upload File'>
    </form>
    </body>
    </html>
    <?php
    include 'config.php';
    include 'english.lang.php';
    include 'style.css';
    if (!is_dir("$uploadfolder")) {
    die ("
    <table border='1' style='border-collapse: collapse' bordercolor='#FF0000' bgcolor='#EFEFEF'>
      <tr>
        <td><font family='Franklin Gothic Book' size='1' color='#FF0000'>ERROR: The specified folder ($uploadfolder) doesn't exist!</font></td>
      </tr>
    </table>
    ");
    }
    if (!is_writeable("$uploadfolder")){
    die ("
    <table border='1' style='border-collapse: collapse' bordercolor='#FF0000' bgcolor='#EFEFEF'>
      <tr>
        <td><font family='Franklin Gothic Book' size='1' color='#FF0000'>ERROR: The specified folder ($uploadfolder) isn't writeable. Please CHMOD it to 777</font></td>
      </tr>
    </table>
    ");
    }
    if (is_uploaded_file($_FILES['filetoupload']['tmp_name']))
    {
    
    $size = $_FILES['filetoupload']['size'];
    if ($size > $limit)
    {
    echo "
    <table border='1' style='border-collapse: collapse' bordercolor='#FF0000' bgcolor='#EFEFEF'>
      <tr>
        <td><font family='Franklin Gothic Book' size='1' color='#FF0000'>ERROR: Your file is too large. It must be $sizelimit KB or less!</font></td>
      </tr>
    </table>
    ";
    exit();
    }
    if (($limitfiletype == "yes") && (!in_array($_FILES['filetoupload']['type'],$filetypes)))
    {
    echo"
    <table border='1' style='border-collapse: collapse' bordercolor='#FF0000' bgcolor='#EFEFEF'>
      <tr>
        <td><font family='Franklin Gothic Book' size='1' color='#FF0000'>ERROR: Wrong file type. You are allowed the following file types.<br>
    .gif<br>
    .jpeg<br>
    .jpg<br>
    .png<br>
    .PNG<br>
    .bmp</font></td>
      </tr>
    </table>
    ";
    exit();
    }
    $filename =  $_FILES['filetoupload']['name'];
    if(file_exists($uploadfolder.$filename)){
    echo "
    <table border='1' style='border-collapse: collapse' bordercolor='#FF0000' bgcolor='#EFEFEF'>
      <tr>
        <td><font family='Franklin Gothic Book' size='1' color='#FF0000'>$filename already exists on our servers!</font></td>
      </tr>
    </table>
    ";
    exit();
    }
    if (move_uploaded_file($_FILES['filetoupload']['tmp_name'],$uploadfolder.$filename)) {
    echo "<img src='$uploadfolder$filename'> <br>
    Direct link<br>
    <input size='60' value='$upload_dir$filename'>";
    exit();
    }
    }
    ?>
    Publishing free website designs, watch this space!
    Total number of designs published: 0
    Current work in progress: Landscape Design


  2. #2
    Join Date
    Nov 2007
    Posts
    660
    Tokens
    0

    Default

    I got an idea!

    MAKE YOUR OWN SCRIPT AND STOP USING THEM OFF TUTORIAL SITES
    YOU SAD PERSON!

    Edited by opensourcehost (Forum Super Moderator): Please do not be rude.
    Last edited by Mr.OSH; 05-12-2007 at 08:24 PM.

  3. #3
    Join Date
    Nov 2007
    Posts
    753
    Tokens
    0

    Default

    Get lost! this isnt! ive spent bloody ages on this!
    Publishing free website designs, watch this space!
    Total number of designs published: 0
    Current work in progress: Landscape Design


  4. #4
    Join Date
    Aug 2007
    Posts
    42
    Tokens
    0

    Default

    Quote Originally Posted by zeJosh View Post
    I got an idea!

    MAKE YOUR OWN SCRIPT AND STOP USING THEM OFF TUTORIAL SITES
    YOU SAD PERSON!
    How else do people learn stuff without tutorials ..

  5. #5
    .L!nK. Guest

    Default

    Ask the person who made it

  6. #6
    Join Date
    Nov 2007
    Posts
    753
    Tokens
    0

    Default

    ive been reading loads of tutorials to make this from various websites but i assure you i made this script.
    Publishing free website designs, watch this space!
    Total number of designs published: 0
    Current work in progress: Landscape Design


  7. #7
    Join Date
    Nov 2007
    Posts
    660
    Tokens
    0

    Default

    Taz, he downloaded a free script, and edited it

  8. #8
    Join Date
    Nov 2007
    Posts
    753
    Tokens
    0

    Default

    zeJosh. Get lost. i havent so sort your head out and then read this post again.
    Publishing free website designs, watch this space!
    Total number of designs published: 0
    Current work in progress: Landscape Design


  9. #9
    Join Date
    Aug 2007
    Posts
    42
    Tokens
    0

    Default

    Quote Originally Posted by zeJosh View Post
    Taz, he downloaded a free script, and edited it

    does it really matter?, why take it that serious. i mean if he wants too call it his script let him.. i don't really care to be honest. that's the thing with this forum everyone takes this stuff serious..

  10. #10
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <html>
    <head>
    <title>YOURSITE.com - Image Upload By Forge</title>
    </head>
    <body>
    <form action='index.php' method='post' enctype='multipart/form-data'>
    Browse a File to Upload:<br>
    <input type='file' name='filetoupload'><br>
    <input type='hidden' name='max_image_size' value='<?echo $sizelimit?>'>
    <br>
    <input type='Submit' value='Upload File'>
    </form>
    </body>
    </html>
    <?php
    include 'config.php';
    include 
    'english.lang.php';
    include 
    'style.css';
    $limit 50000;
    if (!
    is_dir("$uploadfolder")) {
    die (
    "
    <table border='1' style='border-collapse: collapse' bordercolor='#FF0000' bgcolor='#EFEFEF'>
      <tr>
        <td><font family='Franklin Gothic Book' size='1' color='#FF0000'>ERROR: The specified folder (
    $uploadfolder) doesn't exist!</font></td>
      </tr>
    </table>
    "
    );
    }
    if (!
    is_writeable("$uploadfolder")){
    die (
    "
    <table border='1' style='border-collapse: collapse' bordercolor='#FF0000' bgcolor='#EFEFEF'>
      <tr>
        <td><font family='Franklin Gothic Book' size='1' color='#FF0000'>ERROR: The specified folder (
    $uploadfolder) isn't writeable. Please CHMOD it to 777</font></td>
      </tr>
    </table>
    "
    );
    }
    if (
    is_uploaded_file($_FILES['filetoupload']['tmp_name']))
    {

    $size $_FILES['filetoupload']['size'];
    if (
    $size $limit)
    {
    echo 
    "
    <table border='1' style='border-collapse: collapse' bordercolor='#FF0000' bgcolor='#EFEFEF'>
      <tr>
        <td><font family='Franklin Gothic Book' size='1' color='#FF0000'>ERROR: Your file is too large. It must be 
    $sizelimit KB or less!</font></td>
      </tr>
    </table>
    "
    ;
    exit();
    }
    if ((
    $limitfiletype == "yes") && (!in_array($_FILES['filetoupload']['type'],$filetypes)))
    {
    echo
    "
    <table border='1' style='border-collapse: collapse' bordercolor='#FF0000' bgcolor='#EFEFEF'>
      <tr>
        <td><font family='Franklin Gothic Book' size='1' color='#FF0000'>ERROR: Wrong file type. You are allowed the following file types.<br>
    .gif<br>
    .jpeg<br>
    .jpg<br>
    .png<br>
    .PNG<br>
    .bmp</font></td>
      </tr>
    </table>
    "
    ;
    exit();
    }
    $filename =  $_FILES['filetoupload']['name'];
    if(
    file_exists($uploadfolder.$filename)){
    echo 
    "
    <table border='1' style='border-collapse: collapse' bordercolor='#FF0000' bgcolor='#EFEFEF'>
      <tr>
        <td><font family='Franklin Gothic Book' size='1' color='#FF0000'>
    $filename already exists on our servers!</font></td>
      </tr>
    </table>
    "
    ;
    exit();
    }
    if (
    move_uploaded_file($_FILES['filetoupload']['tmp_name'],$uploadfolder.$filename)) {
    echo 
    "<img src='$uploadfolder$filename'> <br>
    Direct link<br>
    <input size='60' value='
    $upload_dir$filename'>";
    exit();
    }
    }
    ?>
    Coming and going...
    Highers are getting the better of me

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •