Autor Beitrag
Wolle92
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: 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
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: 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 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Mi 10.10.07 19:52 
wie mach ich das mit htaccess?
Darkpara
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61

Win XP

BeitragVerfasst: Do 11.10.07 18:54 
ich hatte auch erstgrad das gleiche problem habs dann so gelöst:

eine download.php datei:
ausblenden 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:
ausblenden 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 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Do 11.10.07 19:22 
Wozu braucht man denn basename?
Darkpara
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61

Win XP

BeitragVerfasst: 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 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Do 11.10.07 19:29 
ok, ich täts zwar lieber mit htaccess... aber so gehts auch...
Wolle92 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Do 11.10.07 20:59 
Der zeigt mir dass aber als ZIP_Archvi an, kann man das noch ändern?
Darkpara
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61

Win XP

BeitragVerfasst: 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 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: Fr 12.10.07 13:56 
Vielleicht liegts an Firefox... oder an Vista...
Arne K.
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
EE-Autor
Beiträge: 112


C# (VS 2008 Professional)
BeitragVerfasst: Sa 13.10.07 11:07 
user profile iconWolle92 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 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: 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
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: 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
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: So 14.10.07 13:59 
user profile iconHeiko 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 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: So 14.10.07 14:15 
ich kann drauf zugreifen
Arne K.
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
EE-Autor
Beiträge: 112


C# (VS 2008 Professional)
BeitragVerfasst: So 14.10.07 16:34 
user profile iconWolle92 hat folgendes geschrieben:
ich kann drauf zugreifen

Dann verbietest du eben den Zugriff darauf.
ausblenden Quelltext
1:
2:
3:
4:
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
</FilesMatch>
Wolle92 Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1296

Windows Vista Home Premium
Delphi 7 PE, Delphi 7 Portable, bald C++ & DirectX
BeitragVerfasst: So 14.10.07 17:16 
Das steht bei mir in der httpd.conf aber schon drin...