By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,400 Members | 1,368 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,400 IT Pros & Developers. It's quick & easy.

Using header() creating javascript error

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
in*****@gmail.com (Inpreet) wrote in
news:3a**************************@posting.google.c om:
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.


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
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.