CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1

    Downloaded file name

    Code:
    <?
    		$mime = mime_content_type($path);
    		header('Content-type: ' . $mime);
    		readfile($path);
    ?>
    All goes right except if it file must be downloaded then it downladed with name of my php file. Can i say to browser another name?

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Downloaded file name

    If you want to force a download, you better use a few more headers...

    PHP Code:
    header('Content-Disposition: attachment; filename="' basename($file) . '";' );
    header('Content-Transfer-Encoding: binary');
    header('Content-Length: ' . @filesize($file)); 
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured