Force "Save As" dialog on link *WORKING*

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Force "Save As" dialog on link *WORKING*

    hi,
    i am trying to have a link to download a jpg directly, not display it in the browser.

    i've got

    <?php
    if(isset($filename)):
    $headertxt = "Content-Disposition: attachment; filename=\"".$filename."\"";
    header("Content-Type: application/force-download");header($headertxt);
    include("$filename");
    endif;
    ?>

    it works fine for opening an html or text files, it prompts me to save and does so properly.
    however on jpg it prompts me to save as well, but only saves


    <b>Parse error</b>: syntax error, unexpected T_STRING in <b>/test.jpg</b> on line <b>93</b><br />


    any help or suggestions would be greatly appreciated!
    many thanks!!

  • #2
    first of all fix the parse error on line 93.

    Kommentar


    • #3
      thats exactly my problem. why do i get a parse error on downloading jpegs, but not on text files?
      depending on which jpeg i try, the line of the parse error changes.

      Kommentar


      • #4
        can u tell us where line 93 is

        php-Entwicklung | ebiz-consult.de
        PHP-Webhosting für PHP Entwickler | ebiz-webhosting.de
        die PHP Marktplatz-Software | ebiz-trader.de

        Kommentar


        • #5
          well...
          PHP-Code:
          include("$filename"); 
          I don't want to say that it's wrong but ... it's wrong
          Search Google, there are quite a lot scripts for sending downloads via php

          Ein netter Guide zum übersichtlichen Schreiben von PHP/MySQL-Code!

          bei Klammersetzung bevorzuge ich jedoch die JavaCoding-Standards
          Wie man Fragen richtig stellt

          Kommentar


          • #6
            The good book sayeth:
            The include() statement includes and evaluates the specified file.

            Kommentar


            • #7
              Original geschrieben von pekka
              The good book sayeth:
              well ... a German link for an English speaking person? ^^,

              Ein netter Guide zum übersichtlichen Schreiben von PHP/MySQL-Code!

              bei Klammersetzung bevorzuge ich jedoch die JavaCoding-Standards
              Wie man Fragen richtig stellt

              Kommentar


              • #8
                Original geschrieben von ghostgambler
                well ... a German link for an English speaking person? ^^,
                Die haben ne Sprachweiche drin.

                Kommentar


                • #9
                  ... und außerdem postet er in ein deutsches board, also, was soll das?

                  und keiner hat ihm gesagt, dass er readfile() benutzen soll.

                  [EDIT]
                  ein ami oder engländer nennt sich bestimmt nicht "apfeloma"
                  Zuletzt geändert von 3DMax; 20.08.2006, 03:23.

                  Kommentar

                  Lädt...
                  X