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 2 of 2 FirstFirst 12
Results 11 to 15 of 15
  1. #11
    Join Date
    May 2008
    Location
    Cheshire
    Posts
    133
    Tokens
    0

    Default

    #####################
    your coding is a bit iffy
    http://www.paintballfm.com/site/uploader.php << got that fixed, just saying The width of the image can only be: px regardless.


    Tryyyy Thisss edited:
    PHP Code:
    <?php

      $path 
    "usr_pics_uploaded/";
        
    $maxSize == "100000";
        
    $maxWidth == "1500";
        
    $maxHeight == "1500";
        
    $allowedExt == array('jpg''gif''png''zip''psd');
            function 
    get_ext($file){
          
    $ex strstr($file,".");
          return 
    $ex;
        }
        
        if (!
    $_POST['submit']){
        
    ?>
          <form method="post" action="" enctype="multipart/form-data">
            <label>Select Image</label><br />
              <input name="image_file" type="file"><br />
              <input name="submit" type="submit" value="Upload">
            </form>
            
            <?php
            
    }
            
            else{
          
    $file $_FILES['image_file'];
          
          if(
    $file == NULL){
              echo 
    "No image selected.";

            }else{
              
    $random rand(0,9999);
                
    $random *= rand(0,9999);
                
    $random *= rand(0,9999);
                
    $random /= 3;
                
                
    $file_name $random."-".basename($_FILES['image_file']['name']);
                
    $up_path $path.$file_name;
                
    $ext get_ext($file);
                
                list(
    $width$height$ftype$attr) = getimagesize($_FILES['image_file']['tmp_name']);
                
    $fileExt explode(",",$allowedExt);
                
                            if (
    $width $maxWidth){
                  echo 
    "The width of the image can only be: ".$maxWidth."px";
                }elseif (
    $height $maxHeight){
                  echo 
    "The height of the image can only be: ".$maxHeight."px";

                }elseif (!
    in_array($ext,$fileExt)){
                  echo 
    "File extention not recognized.<br /> Allowed extentions: ".$allowedExt;

                }else{
                  if(
    move_uploaded_file($file_name,$up_path)){

                    }else{
                        echo 
    "Error with uploading the image.";

                    }
                }
            }
        }
    ?>
    Last edited by CoolHostUK-Dom; 05-06-2008 at 09:50 PM.

  2. #12
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    I get the following error: The width of the image can only be: px.

    Then it doesn't even upload.

  3. #13
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    I'm sure someone knows what's wrong with this, please.

    Edited by Kaotix12 (Forum Moderator): Please do not double post in order to bump your thread.
    Last edited by Ashley; 06-06-2008 at 03:44 PM.

  4. #14
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Try post it in the "Ask the coding community"

  5. #15
    Join Date
    Jun 2007
    Location
    Leicester
    Posts
    1,607
    Tokens
    0

    Latest Awards:

    Default

    Try this:

    PHP Code:
     <?php

      $path 
    "upload/";
        
    $maxSize "100000";
        
    $maxWidth "1500";
        
    $maxHeight "1500";
        
    $allowedExt ".gif,.bmp,.png,.jpg,.zip,.psd,.GIF,.BMP,.PNG,.JPG,.ZIP,.PSD";
        
            function 
    get_ext($file){
          
    $ex strstr($file,".");
          return 
    $ex;
        }
        
        if (!
    $_POST['submit']){
        
    ?>
          <form method="post" action="" enctype="multipart/form-data">
            <label>Select Image</label><br />
              <input name="image_file" type="file"><br />
              <input name="submit" type="submit" value="Upload">
            </form>
            
            <?php
            
    }
            
            else{
          
    $file $_FILES['image_file'];
          
          if(
    $file == NULL){
              echo 
    "No image selected.";

            }else{
              
    $random rand(0,9999);
                
    $random *= rand(0,9999);
                
    $random *= rand(0,9999);
                
    $random /= 3;
                
                
    $file_name $random."-".basename($_FILES['image_file']['name']);
                
    $up_path $path.$file_name;
                
    $ext get_ext($file);
                
                list(
    $width$height$ftype$attr) = getimagesize($_FILES['image_file']['tmp_name']);
                
    $fileExt explode(",",$allowedExt);
                
                            if (
    $width $maxWidth){
                  echo 
    "The width of the image can only be: ".$maxWidth."px";
                }elseif (
    $height $maxHeight){
                  echo 
    "The height of the image can only be: ".$maxHeight."px";

                }elseif (!
    in_array($ext,$fileExt)){
                  echo 
    "File extention not recognized.<br /> Allowed extentions: ".$allowedExt;

                }else{
                  if(
    move_uploaded_file($file_name,$up_path)){

                    }else{
                        echo 
    "Error with uploading the image.";

                    }
                }
            }
        }
    ?>

Page 2 of 2 FirstFirst 12

Posting Permissions

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