PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
Falsche Informationen in "Speichern unter"-Dialog
Beitrag
<blockquote data-quote="emtrion" data-source="post: 2031016" data-attributes="member: 549553"><p><strong>AW: Falsche Informationen in "Speichern unter"-Dialog</strong></p><p></p><p>Ich glaub ich hab es geschafft! <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p></p><p>Men Problem trat auf, sobald ich die Zeile </p><p>[PHP]header("Content-Type: application/force-download");[/PHP] benutzt hatte. Wenn ich die Zeile weglasse, dann geht es in Firefox zwar, aber Safari ist damit nicht zufrieden. Also hab ich über mime_content_type() wieder versucht den MimeType mitzugeben. Hat bei mir aber ebenfalls nicht funktioniert, da es die Funktion mime_content_type() nicht gab.</p><p></p><p>Also hab ich dafür folendes eingefügt und die Funktion quasi nachgebaut:</p><p>[PHP]if(!function_exists('mime_content_type')) {</p><p></p><p></p><p> function mime_content_type($filename) {</p><p> </p><p> $mime_types = array(</p><p></p><p> 'txt' => 'text/plain',</p><p> 'htm' => 'text/html',</p><p> 'html' => 'text/html',</p><p> 'php' => 'text/html',</p><p> 'css' => 'text/css',</p><p> 'js' => 'application/javascript',</p><p> 'json' => 'application/json',</p><p> 'xml' => 'application/xml',</p><p> 'swf' => 'application/x-shockwave-flash',</p><p> 'flv' => 'video/x-flv',</p><p></p><p> // images</p><p> 'png' => 'image/png',</p><p> 'jpe' => 'image/jpeg',</p><p> 'jpeg' => 'image/jpeg',</p><p> 'jpg' => 'image/jpeg',</p><p> 'gif' => 'image/gif',</p><p> 'bmp' => 'image/bmp',</p><p> 'ico' => 'image/vnd.microsoft.icon',</p><p> 'tiff' => 'image/tiff',</p><p> 'tif' => 'image/tiff',</p><p> 'svg' => 'image/svg+xml',</p><p> 'svgz' => 'image/svg+xml',</p><p></p><p> // archives</p><p> 'zip' => 'application/zip',</p><p> 'rar' => 'application/x-rar-compressed',</p><p> 'exe' => 'application/x-msdownload',</p><p> 'msi' => 'application/x-msdownload',</p><p> 'cab' => 'application/vnd.ms-cab-compressed',</p><p></p><p> // audio/video</p><p> 'mp3' => 'audio/mpeg',</p><p> 'qt' => 'video/quicktime',</p><p> 'mov' => 'video/quicktime',</p><p></p><p> // adobe</p><p> 'pdf' => 'application/pdf',</p><p> 'psd' => 'image/vnd.adobe.photoshop',</p><p> 'ai' => 'application/postscript',</p><p> 'eps' => 'application/postscript',</p><p> 'ps' => 'application/postscript',</p><p></p><p> // ms office</p><p> 'doc' => 'application/msword',</p><p> 'rtf' => 'application/rtf',</p><p> 'xls' => 'application/vnd.ms-excel',</p><p> 'ppt' => 'application/vnd.ms-powerpoint',</p><p></p><p> // open office</p><p> 'odt' => 'application/vnd.oasis.opendocument.text',</p><p> 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',</p><p> );</p><p></p><p> $ext = strtolower(array_pop(explode('.',$filename)));</p><p> if (array_key_exists($ext, $mime_types)) {</p><p> return $mime_types[$ext];</p><p> }</p><p> elseif (function_exists('finfo_open')) {</p><p> $finfo = finfo_open(FILEINFO_MIME);</p><p> $mimetype = finfo_file($finfo, $filename);</p><p> finfo_close($finfo);</p><p> return $mimetype;</p><p> }</p><p> else {</p><p> return 'application/octet-stream';</p><p> }</p><p> }</p><p>}[/PHP]Bei mir funktioniert es jetzt soweit in IE, Firefox, und Safari. In Chrom ebenfalls aber der startet den Download immer automatisch ohne einen "Speichern unter"-Dialog. Ich vermute aber das ich das nicht über PHP steuern kann, sondern das dies am Browser liegt.</p><p></p><p>Grüße,</p><p>Stephan</p></blockquote><p></p>
[QUOTE="emtrion, post: 2031016, member: 549553"] [b]AW: Falsche Informationen in "Speichern unter"-Dialog[/b] Ich glaub ich hab es geschafft! :) Men Problem trat auf, sobald ich die Zeile [PHP]header("Content-Type: application/force-download");[/PHP] benutzt hatte. Wenn ich die Zeile weglasse, dann geht es in Firefox zwar, aber Safari ist damit nicht zufrieden. Also hab ich über mime_content_type() wieder versucht den MimeType mitzugeben. Hat bei mir aber ebenfalls nicht funktioniert, da es die Funktion mime_content_type() nicht gab. Also hab ich dafür folendes eingefügt und die Funktion quasi nachgebaut: [PHP]if(!function_exists('mime_content_type')) { function mime_content_type($filename) { $mime_types = array( 'txt' => 'text/plain', 'htm' => 'text/html', 'html' => 'text/html', 'php' => 'text/html', 'css' => 'text/css', 'js' => 'application/javascript', 'json' => 'application/json', 'xml' => 'application/xml', 'swf' => 'application/x-shockwave-flash', 'flv' => 'video/x-flv', // images 'png' => 'image/png', 'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'gif' => 'image/gif', 'bmp' => 'image/bmp', 'ico' => 'image/vnd.microsoft.icon', 'tiff' => 'image/tiff', 'tif' => 'image/tiff', 'svg' => 'image/svg+xml', 'svgz' => 'image/svg+xml', // archives 'zip' => 'application/zip', 'rar' => 'application/x-rar-compressed', 'exe' => 'application/x-msdownload', 'msi' => 'application/x-msdownload', 'cab' => 'application/vnd.ms-cab-compressed', // audio/video 'mp3' => 'audio/mpeg', 'qt' => 'video/quicktime', 'mov' => 'video/quicktime', // adobe 'pdf' => 'application/pdf', 'psd' => 'image/vnd.adobe.photoshop', 'ai' => 'application/postscript', 'eps' => 'application/postscript', 'ps' => 'application/postscript', // ms office 'doc' => 'application/msword', 'rtf' => 'application/rtf', 'xls' => 'application/vnd.ms-excel', 'ppt' => 'application/vnd.ms-powerpoint', // open office 'odt' => 'application/vnd.oasis.opendocument.text', 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', ); $ext = strtolower(array_pop(explode('.',$filename))); if (array_key_exists($ext, $mime_types)) { return $mime_types[$ext]; } elseif (function_exists('finfo_open')) { $finfo = finfo_open(FILEINFO_MIME); $mimetype = finfo_file($finfo, $filename); finfo_close($finfo); return $mimetype; } else { return 'application/octet-stream'; } } }[/PHP]Bei mir funktioniert es jetzt soweit in IE, Firefox, und Safari. In Chrom ebenfalls aber der startet den Download immer automatisch ohne einen "Speichern unter"-Dialog. Ich vermute aber das ich das nicht über PHP steuern kann, sondern das dies am Browser liegt. Grüße, Stephan [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ▲ = 7, ▼ = 3, ◇ = 2 und die Summe von ▲ und ▼ durch ◇ geteilt wird, was ist das Ergebnis?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
Falsche Informationen in "Speichern unter"-Dialog
Oben