• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

File Open Dialog - Mehrfachauswahl ???

Status
Für weitere Antworten geschlossen.

tomx992

Neues Mitglied
Hallo,

ich habe eine Frage. Mit einem <input type="file"> kann ich in HTML jedesmal nur 1 einzige Datei auswählen.

Hat jemand von Euch Ahnung, wie (VBScript, JScript, JavaScript, HTML) es möglich ist, eine Mehrfachselektion hinzubekommen???

Danke,

beste Grüße

tom
 
Werbung:
Werbung:
Mehrfach-Input Type="Files" sind nicht gewünscht und auch kein Applet.

Aber ich habe ne lösung gefunden (dazu müssen aber die sicherheitseinstellungen sehr niedrig sein)

Code:
<html>
<head>
<script language="jscript">
function  dialog()
{
// Create the Object
cd = new ActiveXObject("MSComDlg.CommonDialog");
// Set filefilter
cd.Filter = "All Files(*.*)|*.*|JScript Files(*.js)|*.js";
cd.FilterIndex = 2;
// Must set MaxFileSize. Otherwise you will get an error
cd.MaxFileSize = 128;
cd.Flags = 8913408;
// Show it to user
cd.ShowOpen();
// Retrieve file + path
file = cd.FileName;
// If the user does enter file exit
if ( !file ) 
{   WScript.Echo("You must enter a file name");   
WScript.Quit(0);
} 
else 
{   
WScript.Echo("The user selected:\n" + file );
}
}
</script>
<body>
<form name="testform" method="POST">
<input type="button" value="klick mich" onclick="return dialog();">
</form>
</body>
</head>
</html>
und hier das geht auch noch
Code:
<html>
<div id="img"></div>
<OBJECT ID="CommonDialog2" STYLE="LEFT: 0px; TOP: 0px"
CLASSID="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB">
<PARAM NAME="_ExtentX" VALUE="847"> 
<PARAM NAME="_ExtentY" VALUE="847">
<PARAM NAME="_Version" VALUE="393216"> 
<PARAM NAME="CancelError" VALUE="0">
<PARAM NAME="Color" VALUE="0"> 
<PARAM NAME="Copies" VALUE="1">
<PARAM NAME="DefaultExt" VALUE=""> 
<PARAM NAME="DialogTitle" VALUE="DTS-Dateiauswahl">
<PARAM NAME="FileName" VALUE="">
<PARAM NAME="Filter" VALUE="(*.gif)|*.gif|(*.jpg)|*.jpg|All Files (*.*)|*.*">
<PARAM NAME="FilterIndex" VALUE="1"> 
<PARAM NAME="Flags" VALUE="8913408">
<PARAM NAME="FontBold" VALUE="0"> 
<PARAM NAME="FontItalic" VALUE="0">
<PARAM NAME="FontName" VALUE=""> 
<PARAM NAME="FontSize" VALUE="8">
<PARAM NAME="FontStrikeThru" VALUE="0"> 
<PARAM NAME="FontUnderLine" VALUE="0">
<PARAM NAME="FromPage" VALUE="0"> 
<PARAM NAME="HelpCommand" VALUE="0">
<PARAM NAME="HelpContext" VALUE="0"> 
<PARAM NAME="HelpFile" VALUE="">
<PARAM NAME="HelpKey" VALUE=""> 
<PARAM NAME="InitDir" VALUE="">
<PARAM NAME="Max" VALUE="2"> 
<PARAM NAME="Min" VALUE="0">
<PARAM NAME="MaxFileSize" VALUE="260"> 
<PARAM NAME="PrinterDefault" VALUE="0">
<PARAM NAME="ToPage" VALUE="0"> 
<PARAM NAME="Orientation" VALUE="0">
</OBJECT>

<SCRIPT TYPE="text/javascript">
function LoadFile2() 
{ 
CommonDialog2.ShowOpen();
document.getElementById("img").innerHTML = "<iframe width=\"100%\" height=\"100%\" border=\"0\" id=\"message\"></iframe>";
var filename = CommonDialog2.FileName;
var isNull = true;
for(i=0;i<filename.length;i++)
if(filename.substr(i,1) != " ")
isNull = false;
if(!isNull)
message.document.write("<img src=\""+CommonDialog2.FileName+"\">");
else
message.document.write("");
}
//document.onload=LoadFile2();
</Script>
<body>
<input type="file" value="klick" onclick="return LoadFile2();">
</body>
</html>

passt doch oder?

MODEDIT: Doppelpost entfernt (w7)
 
Zuletzt bearbeitet von einem Moderator:
Status
Für weitere Antworten geschlossen.
Zurück
Oben