Download-Script: strange "[1]." in Filename

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Download-Script: strange "[1]." in Filename

    Hello folks!

    I've got a strange problem with my download-script in conjunction with
    M$ internet explorer, if the filename I want to link to includes more
    than one points. In Netscape the problem doesn't exist.

    For example:

    input: ... download.php?name=virtualdub_1.4.9.zip

    Code:
    header("Content-Type: application/octet-stream");
    header("Content-Length: " . filesize($file));
    header("Content-Disposition: attachment; filename=".$name);
    header("Content-Transfer-Encoding: binary");
    output: ... save file to disk: virtualdub_1[1].4.9.zip

    Plz hlp! Thx.
    Kornelius F.

    Kornelius Finkenbein Guest

  2. Similar Questions and Discussions

    1. "The filename or extension is too long" Error when opening Acrobat 6.0
      I get the same error. It just hangs at the splash screen, taking 100% CPU and then after about an hour I get that error. When I click ok, I get a...
    2. <param name="filename" value="file:///C:/...."
      Hello, got a problem with the next code trying to load the swf from the client pc: <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"...
    3. "Devel::DProf" on a PERL script uses "Test::More"
      Dear all, I encountered a problem while run profiling on a script which uses "Test::More". May I ask whether anybody have some idea or wrap...
    4. strange error "Unsuccessful stat on filename "
      Pitt wrote: Based solely on the error message (don't have Unix system to verify), I think this:: MM_Unix.pm line 2775 is the line of Perl code...
    5. How do you simulate "." or "source" in a perl script ?
      On 7 Aug 2003 08:21:27 -0700 c_j_marshall@hotmail.com (Chris Marshall) wrote: Shell::Source perhaps this CPAN module will do it for you. ...
  3. #2

    Default Re: Download-Script: strange "[1]." in Filename

    Kornelius Finkenbein <kofi1@web.de> wrote in message news:<bp0cm1$nk$05$1@news.t-online.com>...
    > Hello folks!
    >
    > I've got a strange problem with my download-script in conjunction with
    > M$ internet explorer, if the filename I want to link to includes more
    > than one points. In Netscape the problem doesn't exist.
    >
    > For example:
    >
    > input: ... download.php?name=virtualdub_1.4.9.zip
    >
    >
    Code:
    > 	header("Content-Type: application/octet-stream");
    > 	header("Content-Length: " . filesize($file));
    > 	header("Content-Disposition: attachment; filename=".$name);
    > 	header("Content-Transfer-Encoding: binary");
    >
    >
    > output: ... save file to disk: virtualdub_1[1].4.9.zip
    >
    Try this:

    <?php
    header('Content-Type: XXXXXXXXXXXXXX');
    //IE need specific header
    if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE"))
    {
    header('Content-Disposition: inline; filename="'.$file_name.'"');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    }
    else
    {
    header('Content-Disposition: attachment;
    filename="'.$file_name.'"');
    header('Pragma: no-cache');
    }
    ?>

    If it doesn't work read the usernotes at [url]http://in.php.net/header[/url]
    that may be helpful.

    ---
    "War kills you and me"
    Email: rrjanbiah-at-Y!com
    R. Rajesh Jeba Anbiah Guest

  4. #3

    Default Re: Download-Script: strange "[1]." in Filename

    Thanks for your help, but that didn't solve the problem yet.
    I've looked on [url]http://in.php.net/header[/url] and searched again in Google,
    but I can't find a solution for it.

    Perhaps it's the best to eliminate all points in filename except the
    last one of course.

    Thx. Kornelius



    R. Rajesh Jeba Anbiah schrieb:
    > Kornelius Finkenbein <kofi1@web.de> wrote in message news:<bp0cm1$nk$05$1@news.t-online.com>...
    >
    >>Hello folks!
    >>
    >>I've got a strange problem with my download-script in conjunction with
    >>M$ internet explorer, if the filename I want to link to includes more
    >>than one points. In Netscape the problem doesn't exist.
    >>
    >>For example:
    >>
    >>input: ... download.php?name=virtualdub_1.4.9.zip
    >>
    >>
    Code:
    >>	header("Content-Type: application/octet-stream");
    >>	header("Content-Length: " . filesize($file));
    >>	header("Content-Disposition: attachment; filename=".$name);
    >>	header("Content-Transfer-Encoding: binary");
    >>
    >>
    >>output: ... save file to disk: virtualdub_1[1].4.9.zip
    >>
    >
    >
    > Try this:
    >
    > <?php
    > header('Content-Type: XXXXXXXXXXXXXX');
    > //IE need specific header
    > if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE"))
    > {
    > header('Content-Disposition: inline; filename="'.$file_name.'"');
    > header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    > header('Pragma: public');
    > }
    > else
    > {
    > header('Content-Disposition: attachment;
    > filename="'.$file_name.'"');
    > header('Pragma: no-cache');
    > }
    > ?>
    >
    > If it doesn't work read the usernotes at [url]http://in.php.net/header[/url]
    > that may be helpful.
    >
    > ---
    > "War kills you and me"
    > Email: rrjanbiah-at-Y!com
    Kornelius Finkenbein Guest

  5. #4

    Default Re: Download-Script: strange "[1]." in Filename

    Kornelius Finkenbein <kofi1@web.de> wrote in message news:<bp28tl$6md$01$1@news.t-online.com>...
    > Thanks for your help, but that didn't solve the problem yet.
    > I've looked on [url]http://in.php.net/header[/url] and searched again in Google,
    > but I can't find a solution for it.
    >
    > Perhaps it's the best to eliminate all points in filename except the
    > last one of course.
    I dont' think, it will help you. Just checked phpMyAdmin; it also
    has the same problem with zip. If even phpMyAdmin guys couldn't solve
    this problem, I don't think it's possible. Anyway, you keep on trying.
    Probably some HTTP sniff will be useful to you.

    ---
    "Believe it or not, patriotism is one of the worst dividing forces"
    Email: rrjanbiah-at-Y!com
    R. Rajesh Jeba Anbiah Guest

  6. #5

    Default Re: Download-Script: strange "[1]." in Filename

    [email]ng4rrjanbiah@rediffmail.com[/email] (R. Rajesh Jeba Anbiah) wrote in message news:<abc4d8b8.0311142144.3ec6762c@posting.google. com>...
    > Kornelius Finkenbein <kofi1@web.de> wrote in message news:<bp28tl$6md$01$1@news.t-online.com>...
    > > Thanks for your help, but that didn't solve the problem yet.
    > > I've looked on [url]http://in.php.net/header[/url] and searched again in Google,
    > > but I can't find a solution for it.
    > >
    > > Perhaps it's the best to eliminate all points in filename except the
    > > last one of course.
    >
    > I dont' think, it will help you. Just checked phpMyAdmin; it also
    > has the same problem with zip. If even phpMyAdmin guys couldn't solve
    > this problem, I don't think it's possible. Anyway, you keep on trying.
    > Probably some HTTP sniff will be useful to you.
    I checked Yahoo! It doesn't have this problem and so worked on
    the headers... Finally found the solution!!!! Now, it works fine!!!

    <?php
    //This file name: download_zip.php
    //Tested in IE6

    $filename = "rajesh.zip";
    header('Content-Type: application/x-zip-compressed;
    filename="foo.bar"');
    header('Content-Disposition: attachment; filename="' . $filename .
    '"');
    readfile($filename);
    exit;
    ?>

    <!---html file name: test.html--->

    <a href="download_zip.php">test</a>



    Now, open the test.html and click the link. Please confirm, if
    it's work for you.

    ---
    "Believe it or not, patriotism is one of the worst dividing forces"
    Email: rrjanbiah-at-Y!com
    R. Rajesh Jeba Anbiah Guest

  7. #6

    Default Re: Download-Script: strange "[1]." in Filename

    Don't know if you understood my problem: I have no problem with the
    download-script in conjunction with zip-files. The problem exists only,
    if files have more than one point in the filename: f.e.
    "virtualdub_1.5.9.zip". Before the first point I get this: "[1]".
    The result is this filename: "virtualdub_1[1].5.9.zip".

    Your filename "rajesh.zip" has only one point, thats no problem.
    BTW, I could not open a test.htm. There were no attachment or link.

    But thanks anyway for all.
    Kornelius.

    >
    >
    > I checked Yahoo! It doesn't have this problem and so worked on
    > the headers... Finally found the solution!!!! Now, it works fine!!!
    >
    > <?php
    > //This file name: download_zip.php
    > //Tested in IE6
    >
    > $filename = "rajesh.zip";
    > header('Content-Type: application/x-zip-compressed;
    > filename="foo.bar"');
    > header('Content-Disposition: attachment; filename="' . $filename .
    > '"');
    > readfile($filename);
    > exit;
    > ?>
    >
    > <!---html file name: test.html--->
    >
    > <a href="download_zip.php">test</a>
    >
    >
    >
    > Now, open the test.html and click the link. Please confirm, if
    > it's work for you.
    >
    > ---
    > "Believe it or not, patriotism is one of the worst dividing forces"
    > Email: rrjanbiah-at-Y!com
    Kornelius Finkenbein Guest

  8. #7

    Default Re: Download-Script: strange "[1]." in Filename

    On Mon, 17 Nov 2003 12:11:10 +0100, Kornelius Finkenbein wrote:
    > Don't know if you understood my problem: I have no problem with the
    > download-script in conjunction with zip-files. The problem exists only,
    > if files have more than one point in the filename: f.e.
    > "virtualdub_1.5.9.zip". Before the first point I get this: "[1]".
    > The result is this filename: "virtualdub_1[1].5.9.zip".
    >
    > Your filename "rajesh.zip" has only one point, thats no problem.
    > BTW, I could not open a test.htm. There were no attachment or link.
    >
    > But thanks anyway for all.
    > Kornelius.
    >
    >
    >>
    >>
    >> I checked Yahoo! It doesn't have this problem and so worked on
    >> the headers... Finally found the solution!!!! Now, it works fine!!!
    >>
    >> <?php
    >> //This file name: download_zip.php
    >> //Tested in IE6
    >>
    >> $filename = "rajesh.zip";
    >> header('Content-Type: application/x-zip-compressed;
    >> filename="foo.bar"');
    >> header('Content-Disposition: attachment; filename="' . $filename .
    >> '"');
    >> readfile($filename);
    >> exit;
    >> ?>
    >>
    >> <!---html file name: test.html--->
    >>
    >> <a href="download_zip.php">test</a>
    >>
    >>
    >>
    >> Now, open the test.html and click the link. Please confirm, if
    >> it's work for you.
    >>
    >> ---
    >> "Believe it or not, patriotism is one of the worst dividing forces"
    >> Email: rrjanbiah-at-Y!com
    Are you sure you don't have a file already called (whatever it was you were
    trying to download) already? Usually the [1] comes when some program (like
    IE) has to give a downloaded file a new name because the current file
    already exists.

    Also, have you tried the page in other browsers? If it works in something
    else, it's probably just some sort of client-side problem. You could also
    get a header-sniffer to see what the actual filename the script is giving
    you is.
    --
    -- Rudy Fleminger
    -- [email]sp@mmers.and.evil.ones.will.bow-down-to.us[/email]
    (put "Hey!" in the Subject line for priority processing!)
    -- [url]http://www.pixelsaredead.com[/url]
    FLEB Guest

  9. #8

    Default Re: Download-Script: strange "[1]." in Filename

    Kornelius Finkenbein <kofi1@web.de> wrote in message news:<bpaabu$sih$06$1@news.t-online.com>...
    > Don't know if you understood my problem: I have no problem with the
    > download-script in conjunction with zip-files. The problem exists only,
    > if files have more than one point in the filename: f.e.
    > "virtualdub_1.5.9.zip". Before the first point I get this: "[1]".
    > The result is this filename: "virtualdub_1[1].5.9.zip".
    Sorry for misunderstanding your problem. Yes, it seems to dislike
    the extra points in file name. It's really strange.

    ---
    "War kills you and me"
    Email: rrjanbiah-at-Y!com
    R. Rajesh Jeba Anbiah Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139