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 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Force Download

  1. #11
    Join Date
    Apr 2006
    Location
    England
    Posts
    1,159
    Tokens
    0

    Latest Awards:

    Default

    I have a zillion times. I don't need it urgently, I just thought I could give my visitors the ability to download files from our database which have been uploaded from other users.
    REMOVED

    Edited by jesus (Forum Super Moderator): Please do not have text in your signature which is over size 4.

  2. #12
    Join Date
    Aug 2006
    Posts
    181
    Tokens
    0

    Default

    Hmm no sorry.

    You could always put like 'To Download This Image - Right click on the image and press save as'

  3. #13
    Join Date
    Apr 2006
    Location
    England
    Posts
    1,159
    Tokens
    0

    Latest Awards:

    Default

    That's my alternative
    Although, I did plan to disable right click to put a stop to multiple uploads (which will eat my bandwith) through right click >> refresh.
    Last edited by Halting; 01-09-2006 at 10:22 PM.
    REMOVED

    Edited by jesus (Forum Super Moderator): Please do not have text in your signature which is over size 4.

  4. #14
    Join Date
    Jan 2006
    Location
    Manchester, UK
    Posts
    233
    Tokens
    0

    Default

    Perhaps use .htaccess to re-direct to the image file.

  5. #15
    Join Date
    Aug 2006
    Location
    Doncaster, UK
    Posts
    346
    Tokens
    0

    Default

    cAN YOU force a download?

    I thought it only let you upload specific extensions?
    Sig Removed by -legoman- (Super Moderator) Due to it being offensive.

  6. #16
    Join Date
    Nov 2005
    Posts
    807
    Tokens
    1,335

    Latest Awards:

    Default

    zip the images up..

  7. #17
    Join Date
    Apr 2006
    Location
    England
    Posts
    1,159
    Tokens
    0

    Latest Awards:

    Default

    Perhaps use .htaccess to re-direct to the image file.
    What do you mean? If you redirected a window to the image it would just display the image rather than download.

    zip the images up..
    I've already said why I'm not doing that.
    REMOVED

    Edited by jesus (Forum Super Moderator): Please do not have text in your signature which is over size 4.

  8. #18
    Join Date
    Jun 2006
    Posts
    4,832
    Tokens
    0

    Latest Awards:

    Default

    Put it in a zip, and it'll ask if you want to download it?

    edit: read post, hmm, I do not know, I will have a look.
    Last edited by Hitman; 02-09-2006 at 10:19 AM.

  9. #19
    Join Date
    Jan 2006
    Location
    Manchester, UK
    Posts
    233
    Tokens
    0

    Default

    Try modifying this. I got it off hotscripts.

    PHP Code:
    <?php
    $filename 
    $_GET['file'];
    // required for IE, otherwise Content-disposition is ignored
    if(ini_get('zlib.output_compression'))
      
    ini_set('zlib.output_compression''Off');
    // addition by Jorg Weske
    $file_extension strtolower(substr(strrchr($filename,"."),1));
    if( 
    $filename == "" 
    {
      echo 
    "<html><title>Download Script</title><body>ERROR: download file NOT SPECIFIED. USE force-download.php?file=filepath</body></html>";
      exit;
    } elseif ( ! 
    file_exists$filename ) ) 
    {
      echo 
    "<html><title> Download Script</title><body>ERROR: File not found. USE force-download.php?file=filepath</body></html>";
      exit;
    };
    switch( 
    $file_extension )
    {
      case 
    "pdf"$ctype="application/pdf"; break;
      case 
    "exe"$ctype="application/octet-stream"; break;
      case 
    "zip"$ctype="application/zip"; break;
      case 
    "doc"$ctype="application/msword"; break;
      case 
    "xls"$ctype="application/vnd.ms-excel"; break;
      case 
    "ppt"$ctype="application/vnd.ms-powerpoint"; break;
      case 
    "gif"$ctype="image/gif"; break;
      case 
    "png"$ctype="image/png"; break;
      case 
    "jpeg":
      case 
    "jpg"$ctype="image/jpg"; break;
      default: 
    $ctype="application/force-download";
    }
    header("Pragma: public"); // required
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: private",false); // required for certain browsers 
    header("Content-Type: $ctype");
    // change, added quotes to allow spaces in filenames, by Rajkumar Singh
    header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: ".filesize($filename));
    readfile("$filename");
    exit();
    ?>

  10. #20
    Join Date
    Feb 2006
    Location
    Coventry
    Posts
    2,096
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Yeah View Post
    Hm then i don't think its possible, try www.google.com
    Its actually possible, heres the code:

    PHP Code:

    <?
    $file 
    $_GET['file'];
    header ("Content-type: octet/stream");
    header ("Content-disposition: attachment; filename=".$file.";");
    header("Content-Length: ".filesize($file));
    readfile($file);
    exit;
    ?>
    Save that as process.php

    Then to download the file put..

    Code:
    <a href="process.php?file=picture.jpg">Download JPG image</a>


    source: http://www.sometricks.com/2006/04/23...he-web-browser

Page 2 of 3 FirstFirst 123 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
  •