Connecting Tech Pros Worldwide Help | Site Map

Using header() creating javascript error

Inpreet
Guest
 
Posts: n/a
#1: Jul 17 '05
Hello
I am using:
************************************************** ***********************
header("Content-Type:application/force-download",false);
header("Content-Disposition: attachment; filename= "
..basename($file));
@readfile($file);
************************************************** ***********************
to let user get popup window with options to download file on his
local machine.
But particuler this line:
************************************************** ***********************
header("Content-Disposition: attachment; filename= "
..basename($file));
************************************************** ***********************
is creating problem in code. Download file functionality is working
fine, no problems in that. But it starts creating javascript errors on
page.Javascript Error: Unspecified error.

If I am using
************************************************** ***********************
header("Content-Type:application/force-download",false);
@readfile($file);
************************************************** ***********************
Code is working fine without any javascript error but save file in
comma seperated text format which is not required format. I need file
to be in .csv format.

Please guide me thru.....
Inpreet Singh
Senator Jay Billington Bulworth
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Using header() creating javascript error


inpreet@gmail.com (Inpreet) wrote in
news:3abb263e.0504070632.4616f72d@posting.google.c om:
[color=blue]
> Hello
> I am using:
> ************************************************** *********************[/color]
**[color=blue]
> header("Content-Type:application/force-download",false);
> header("Content-Disposition: attachment; filename= "
> .basename($file));
> @readfile($file);
> ************************************************** *********************[/color]
**[color=blue]
> to let user get popup window with options to download file on his
> local machine.
> But particuler this line:
> ************************************************** *********************[/color]
**[color=blue]
> header("Content-Disposition: attachment; filename= "
> .basename($file));
> ************************************************** *********************[/color]
**[color=blue]
> is creating problem in code. Download file functionality is working
> fine, no problems in that. But it starts creating javascript errors on
> page.Javascript Error: Unspecified error.[/color]

I'm not sure if this is the problem, but it looks like you have an extra
space after the filename= portion of the header. See if removing that
space fixes the error.

hth


--

Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fung.arg');
--------------------------|---------------------------------
<http://www.phplabs.com/> | PHP scripts, webmaster resources
Closed Thread