wrong file name

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
boom
Forum Newbie
Posts: 3
Joined: Mon Apr 10, 2006 6:11 am

wrong file name

Post by boom »

Pimptastic | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


hi,
(it is wap page)
i have image, or some video or smth else.

in download.php is do:

Code: Select all

$size = filesize($filename);
type = "image/gif";

header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s', time() ) );

header( 'Cache-control: private' );
header( 'Cache-control: max-age=1800' );
header( 'Content-Type: ' . $type );
header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
header( 'Content-Transfer-Encoding: binary' );
header( 'Content-length: ' . $size );
but in the end, when i download smth to mobile, i see download.php, i shoud be nice_image.gif and so on

where is problem?
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:1. Select the correct board for your query. Take some time to read the guidelines in the sticky topic.
Pimptastic | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Last edited by boom on Thu Apr 13, 2006 5:50 am, edited 1 time in total.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Afaik (and according to rfc1806) the value for the filename should not be between quotes:

Code: Select all

header("Content-Disposition: attachment; filename = $filename");
Btw, you might want to check with a hardcoded $filename first
(If i remember well, a couple of browsers don't like filenames like 'foo/bar.txt')
boom
Forum Newbie
Posts: 3
Joined: Mon Apr 10, 2006 6:11 am

Post by boom »

damn, it doesn't work.
timvw wrote:Afaik (and according to rfc1806) the value for the filename should not be between quotes:

Code: Select all

header("Content-Disposition: attachment; filename = $filename");
Btw, you might want to check with a hardcoded $filename first
(If i remember well, a couple of browsers don't like filenames like 'foo/bar.txt')
Post Reply