Announcement

Collapse
No announcement yet.

Firefox Apolyton Download Issues

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Firefox Apolyton Download Issues

    Whenever I download a file with spaces in its name from apolyton, it truncates all of the name after the first space and puts no extension to the name.

    So when I download:

    Blaha of the Romans 221 B.C.sav

    then this will be downloaded to: Blaha and I manually have to add the ".sav" extension.

    I have developed some php code that will do around this (mainly by replacing spaces with underscores).

    Probably Markos could hack something like this into the forum?

    PHP Code:
    <?php
    $wFile 
    $_GET["file"];
    if (!
    $wFile) exit;

    $fname $_SERVER["DOCUMENT_ROOT"]."/".$wFile;

    preg_match("/.*(\..*)$/"$fname$fname_ext);
    switch(
    $fname_ext)
    {
        case 
    ".jpg":
            
    $content_type "image/jpeg";
            break;
        case 
    ".zip":
            
    $content_type "application/zip";
            break;
        case 
    ".sav":
            
    $content_type "application/savegame";
            break;
        default:
            
    $content_type "";
    }

    $file fopen($fname,"rb");  // open image for reading
    if (!$file)
    {
        echo 
    "Error: File does not exist";
        exit;
    }
    $fsize filesize($fname);

    if (
    $content_type != "")
        
    header("Content-Type: ".$content_type);
    if (
    preg_match("#Firefox#i",$_SERVER["HTTP_USER_AGENT"]))
    {
        
    $wFile str_replace(" ","_",$wFile);
    }
    header("Content-Disposition: attachment; filename=".$wFile);
    header("Content-Length: ".$fsize);

    fpassthru($file);
    fclose($file)
    ?>
    Don't ask me why it puts an extra linebreak in every line...
    Probably another thing Markos could quick-fix

  • #2
    fixed (without your code, but thanks anway )
    Co-Founder, Apolyton Civilization Site
    Co-Owner/Webmaster, Top40-Charts.com | CTO, Apogee Information Systems
    giannopoulos.info: my non-mobile non-photo news & articles blog

    Comment


    • #3
      Well, this was one of the reasons for what I stop using Firefox

      Anyway, now I'm using Maxthon (formerly MyIE2) and I'm happy
      Cuando un dedo señala la luna, los tontos miran el dedo. (del Mayo francés)

      Comment


      • #4
        did you report the issue?
        Co-Founder, Apolyton Civilization Site
        Co-Owner/Webmaster, Top40-Charts.com | CTO, Apogee Information Systems
        giannopoulos.info: my non-mobile non-photo news & articles blog

        Comment


        • #5
          good work
          you even managed to preserve the spaces, how did you do that?

          Comment


          • #6
            Ooh, sweet. This has been bugging me for a while, but I never reported it. Thanks Mark!
            XBox Live: VovanSim
            xbox.com (login required)
            Halo 3 Service Record (I fail at FPS...)
            Spore page

            Comment


            • #7
              Originally posted by MarkG
              did you report the issue?
              I think I told you about it. Said that you didn't have the filename in quotes, and the Firefox didn't like that
              Creator of the Civ3MultiTool

              Comment


              • #8
                Originally posted by Atahualpa
                good work
                you even managed to preserve the spaces, how did you do that?
                My quess: Quote the filename string, it will at least work.
                Creator of the Civ3MultiTool

                Comment


                • #9
                  Well... I didn't report it. I just change my navigator
                  Cuando un dedo señala la luna, los tontos miran el dedo. (del Mayo francés)

                  Comment


                  • #10
                    Originally posted by Gramphos

                    My quess: Quote the filename string, it will at least work.
                    I could've really come to that solution for myself

                    Comment


                    • #11


                      A 4-letter word starts with "n" and ends with "b" springs into my head.
                      (\__/) 07/07/1937 - Never forget
                      (='.'=) "Claims demand evidence; extraordinary claims demand extraordinary evidence." -- Carl Sagan
                      (")_(") "Starting the fire from within."

                      Comment

                      Working...
                      X