Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    May 2006
    Posts
    107
    Thanks
    1
    Thanked 0 Times in 0 Posts

    file download issue

    I am having problem with file download, It downloads file but when i try to open it it says file corrupted.

    here is my code:
    PHP Code:
    $dir=USER_DOCUMENT_PATH;
    if (isset(
    $_REQUEST["action"])) {
        
    $file=$dir.$file;
        
    header("Content-type: application/force-download");
        
    header("Content-Transfer-Encoding: Binary");
        
    header("Content-length: ".filesize($file));
        
    header("Content-disposition: attachment; filename=\"".basename($file)."\"");
        
    readfile("$file");
    } else {
        echo 
    "No file selected";

    here is page link:
    http://www.ujueta.com/file_download....load&file_no=2

    any idea?

  • #2
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    This needs more detail, but most questions regarding this have been answered on this page (read the comments): http://php.net/header


  •  

    Posting Permissions

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