Using header() creating javascript error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Inpreet

    Using header() creating javascript error

    Hello
    I am using:
    *************** *************** *************** *************** *************
    header("Content-Type:applicatio n/force-download",false );
    header("Content-Disposition: attachment; filename= "
    ..basename($fil e));
    @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($fil e));
    *************** *************** *************** *************** *************
    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:applicatio n/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

    #2
    Re: Using header() creating javascript error

    inpreet@gmail.c om (Inpreet) wrote in
    news:3abb263e.0 504070632.4616f 72d@posting.goo gle.com:
    [color=blue]
    > Hello
    > I am using:
    > *************** *************** *************** *************** ***********[/color]
    **[color=blue]
    > header("Content-Type:applicatio n/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@fu ng.arg');
    --------------------------|---------------------------------
    <http://www.phplabs.com/> | PHP scripts, webmaster resources

    Comment

    Working...