Autor |
Beitrag |
Wolle92
Beiträge: 1296
Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
|
Verfasst: Mo 08.10.07 19:48
Hallo,
weiß jetzt nicht, obs auch direkt mit HTML geht oder eher mit JavaScript, aber wie kann ich zum Beispiel bei einem Klick auf einen Link zu einer MP3_Datei direkt den Download starten und nicht zum Beispiel mit Quick Time öffnen lassen?
|
|
jakobwenzel
Beiträge: 1889
Erhaltene Danke: 1
XP home, ubuntu
BDS 2006 Prof
|
Verfasst: Mo 08.10.07 20:12
Du musst den Server dazu bringen, als MIME-Typ Application/octet-stream zu senden. Das geht unter anderem per .htacces oder PHP.
_________________ I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
|
|
Wolle92
Beiträge: 1296
Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
|
Verfasst: Mi 10.10.07 19:52
wie mach ich das mit htaccess?
|
|
Darkpara
Beiträge: 61
Win XP
|
Verfasst: Do 11.10.07 18:54
ich hatte auch erstgrad das gleiche problem habs dann so gelöst:
eine download.php datei:
Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
| <?php if(isset($_GET['datei'])){ $Datei = $_GET['datei']; $Dateiname = basename($Datei); $Größe = filesize($Datei); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=\"" . $Dateiname . "\""); header("Content-Length: $Größe"); readfile($Datei); } ?> |
das rufe ich mit:
Quelltext 1:
| <a style=\"color: #555554;\" href=\"download.php?datei=" . $linkthisfile . "\">" . $entry . "</a><br> |
auf wobei linkthisfile Path und name is also Photos/Bild.jpg z.b.
und entry halt irgend nen name der angezeigt wird.
hoffe das hilft
|
|
Wolle92
Beiträge: 1296
Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
|
Verfasst: Do 11.10.07 19:22
Wozu braucht man denn basename?
|
|
Darkpara
Beiträge: 61
Win XP
|
Verfasst: Do 11.10.07 19:26
hm da müsst ich jetzt raten, aber ich glaub das is der name welcher beim dl im dl dialog angezeigt wird aber ned 100% sicher, hab den script auch aus dem internet übernommen und bisel verändert
|
|
Wolle92
Beiträge: 1296
Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
|
Verfasst: Do 11.10.07 19:29
ok, ich täts zwar lieber mit htaccess... aber so gehts auch...
|
|
Wolle92
Beiträge: 1296
Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
|
Verfasst: Do 11.10.07 20:59
Der zeigt mir dass aber als ZIP_Archvi an, kann man das noch ändern?
|
|
Darkpara
Beiträge: 61
Win XP
|
Verfasst: Fr 12.10.07 08:01
hm grad nochma bei mir nachgeschaut da zeigts das jeweilige format an und nicht .zip, keine ahnung wieso das bei dir als .zip angezeigt wird sorry
|
|
Wolle92
Beiträge: 1296
Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
|
Verfasst: Fr 12.10.07 13:56
Vielleicht liegts an Firefox... oder an Vista...
|
|
Arne K.
Beiträge: 112
C# (VS 2008 Professional)
|
Verfasst: Sa 13.10.07 11:07
Wolle92 hat folgendes geschrieben: | Wozu braucht man denn basename? |
Weil du nicht willst, dass via Parameter Injection deine php-Skripte oder gar die root-pwd-Datei herunter geladen werden kann ...
|
|
Wolle92
Beiträge: 1296
Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
|
Verfasst: Sa 13.10.07 13:45
ahhh... stimmt, jetzt, wo du es sagst...
Auch mal eine Frage: Mein Wenserver läuft ja unter Windows, wie kann ich da verhindern, dass man die .htaccess-Datei ansehen kann?
|
|
Heiko
Beiträge: 3169
Erhaltene Danke: 11
|
Verfasst: So 14.10.07 13:03
CHMOD?
Mir ist es zwar bisher nicht untergekommmen, dass man die irgendwo sieht, aerb wenn müsste es über CHMOD gehen (bietet da Win nen Synonym dazu?)
|
|
Timosch
Beiträge: 1314
Debian Squeeze, Win 7 Prof.
D7 Pers
|
Verfasst: So 14.10.07 13:59
Heiko hat folgendes geschrieben: | CHMOD?
Mir ist es zwar bisher nicht untergekommmen, dass man die irgendwo sieht, aerb wenn müsste es über CHMOD gehen (bietet da Win nen Synonym dazu?) |
cacls, aber eigentlich müsste der IIS die von allein verstecken.
_________________ If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell
|
|
Wolle92
Beiträge: 1296
Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
|
Verfasst: So 14.10.07 14:15
|
|
Arne K.
Beiträge: 112
C# (VS 2008 Professional)
|
Verfasst: So 14.10.07 16:34
|
|
Wolle92
Beiträge: 1296
Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
|
Verfasst: So 14.10.07 17:16
Das steht bei mir in der httpd.conf aber schon drin...
|
|