Ankündigung

Einklappen
Keine Ankündigung bisher.

Download misslingt bei Opera

Einklappen

Neue Werbung 2019

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

  • Download misslingt bei Opera

    Hallo liebe PHP Community,
    lang ist es her, aber ich habe mal wieder eine Frage.

    Ich lasse meine Downloads immer mit folgendem Script aufrufen:
    PHP-Code:
    function _Download($f_location,$f_name){
        
    header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        
    header('Content-Description: File Transfer');
        
    header('Content-Type: application/octet-stream');
        
    header('Content-Length: ' filesize($f_location));
        
    header('Content-Disposition: attachment; filename=' basename($f_name));
        
    readfile($f_location);
     }
    ################
    $file "datei.pdf";
    $location 'downloads/'.$file;
    _Download($location$file); 
    Leider wurde mir gerade mitgeteilt, dass bei Opera immer anstelle der Datei die *.php Datei heruntergeladen wird.

    Kann mir dabei jemand helfen ?


    Liebe Grüße
    Björn

  • #2
    Hallo,

    versuche bitte mal die gesendeten Header zu analysieren. Das geht am einfachsten mit einem

    Code:
     wget -vdS example.com
    Evtl. wird ein Header nicht korrekt gesendet oder vom Browser in der gesendeten Reihenfolge falsch interpretiert.
    Viele Grüße,
    Dr.E.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1. Think about software design [B]before[/B] you start to write code!
    2. Discuss and review it together with [B]experts[/B]!
    3. Choose [B]good[/B] tools (-> [URL="http://adventure-php-framework.org/Seite/088-Why-APF"]Adventure PHP Framework (APF)[/URL][URL="http://adventure-php-framework.org"][/URL])!
    4. Write [I][B]clean and reusable[/B][/I] software only!
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Kommentar


    • #3
      Vermutlich fehlen die Anfuehrungszeichen um die filename-Direktive.
      "[URL="http://www.youtube.com/watch?v=yMAa_t9k2VA&feature=youtu.be&t=25s"]Mein Name ist Lohse, ich kaufe hier ein.[/URL]"

      Kommentar


      • #4
        Meinst du so?

        PHP-Code:
        $file "datei.pdf";
        $location '"downloads/'.$file.'"';
        _Download($location$file); 

        Kommentar


        • #5
          Nein.
          "[URL="http://www.youtube.com/watch?v=yMAa_t9k2VA&feature=youtu.be&t=25s"]Mein Name ist Lohse, ich kaufe hier ein.[/URL]"

          Kommentar


          • #6
            PHP-Code:
            header('Content-Disposition: attachment; filename="'.basename($f_name).'"'); 
            [IMG]http://media.ubuntuusers.de/portal/files/ubuntu.png[/IMG][IMG]http://sqlmanager.net/i/ico/mysql.gif[/IMG][SIGPIC][/SIGPIC]

            Kommentar

            Lädt...
            X