Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Download erzwingen mit PHP

Empfohlene Antworten

Hi hat jemand mal ein Beispiel, wie ich mit PHP

den download einer Datei erzwingen kann, die sonst nur im Browser geöffnet werden würde? (XLS,DOC,TXY,HTML)

Danke

Hallo FaFo,

meinst Du, dass der User das schöne Fensterchen erhält:

"Soll die Datei geöffnet/gespeichert werden? blabla"

Dafür gibt es ja "Ziel speichern unter" usw.

Vielleicht gibt es ja ein OnClick-Event in JavaScript. Glaube ich aber eher nicht.

:(

WOHIN sollte die downgeloadete Datei denn gespeichert werden ?

Dafür ist ja der Dialog mit dem User notwendig !

Aber vielleicht hab ich das ja auch mal wieder total falsch verstanden.

Wenn's darum geht, HTML-Dateien z.B. als Offline-Version zum Download anzubieten, dann kannst Du sie doch auch zippen, oder?

AFAIK hat PHP auch ne Library, die sozusagen on the fly Dateien packen kann. Mußt dafür mal im PHP-Manual nachschlagen...

nope, ich meinte schon, dass das gleiche kommt wie wenn du z.b. auf einen link zu einer *.xyz klickst. also ich hab mal sowas gesehen. hätt nur gehofft von euch weiß es einer binnen 20min. ;)

ich werds mir morgen mal anschauen und mal hier posten wie es gemacht wird.

Tach post, hab es gefunden.

 habs jetzt hinbekommen.


<?

$NomFichier = basename($fichier);


header("Content-Type: application/force-download; name=\"$NomFichier\" ");

header("Content-Transfer-Encoding: binary");

header("Content-Length: $taille");



header("Content-Disposition: attachment; filename=\"$NomFichier\" ");

header("Expires: 0");

header("Cache-Control: no-cache, must-revalidate");

header("Pragma: no-cache");



readfile("$NomFichier ");

exit();


?> 
hab ich nur schnell 1:1 aus dem PHPMyExplorer übernommen. beim aufruf dieses phpscripts muß also dann noch name, größe und pfad mit übergeben werden. also so z.B.
 


download.php3?fichier=file://Global01/global-w/MARKT/Give/Give.XLS&chemin=.%2F&taille=50688


Hoffe ihr kommt zurecht, ich jetzt eigentlich schon.

<FONT COLOR="#a62a2a" SIZE="1">[ 08. November 2001 12:29: Beitrag 3 mal editiert, zuletzt von FaFo ]</font>

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Konto

Navigation

Suchen

Suchen

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.