B
!!bogus
Hi,
I found this code in the MSDN library. It works fine for a single upload,
but I can't figure out how to make it work for multiple file uploads...can
someone please help me?
Just paste it in an aspx file and it will work. Although I don't see the
HtmlInputFile class or the fileupload.aspx class that it refers to, it
somehow works.
<%@ Page Language="VB" AutoEventWireup="True" %>
<html>
<script runat="server">
Sub UploadBtn_Click(Sender as Object, e as EventArgs)
' Display information about posted file
FileName.InnerHtml = MyFile.PostedFile.FileName
MyContentType.InnerHtml = MyFile.PostedFile.ContentType
ContentLength.InnerHtml = cStr(MyFile.PostedFile.ContentLength)
FileDetails.Visible = True
' Save uploaded file to server
MyFile.PostedFile.SaveAs("c:\Uploadedfiles\uploadfile.txt")
End Sub
</script>
<body>
<form action="fileupload.aspx"
method="post"
enctype="multipart/form-data"
runat="server">
<h1>ASP.NET File Upload Example</h1>
Select File To Upload to Server:
<input id="MyFile"
type="file"
runat="server">
<br><br>
<input type=submit
value="Upload!"
OnServerclick="UploadBtn_Click"
runat="server">
<br><br><br>
<div id="FileDetails"
Visible=false
runat="server">
FileName: <span id="FileName" runat="server"/> <br>
ContentType: <span id="MyContentType" runat="server"/> <br>
ContentLength: <span id="ContentLength" runat="server"/>bytes
<br>
</div>
</form>
</body>
</html>
I found this code in the MSDN library. It works fine for a single upload,
but I can't figure out how to make it work for multiple file uploads...can
someone please help me?
Just paste it in an aspx file and it will work. Although I don't see the
HtmlInputFile class or the fileupload.aspx class that it refers to, it
somehow works.
<%@ Page Language="VB" AutoEventWireup="True" %>
<html>
<script runat="server">
Sub UploadBtn_Click(Sender as Object, e as EventArgs)
' Display information about posted file
FileName.InnerHtml = MyFile.PostedFile.FileName
MyContentType.InnerHtml = MyFile.PostedFile.ContentType
ContentLength.InnerHtml = cStr(MyFile.PostedFile.ContentLength)
FileDetails.Visible = True
' Save uploaded file to server
MyFile.PostedFile.SaveAs("c:\Uploadedfiles\uploadfile.txt")
End Sub
</script>
<body>
<form action="fileupload.aspx"
method="post"
enctype="multipart/form-data"
runat="server">
<h1>ASP.NET File Upload Example</h1>
Select File To Upload to Server:
<input id="MyFile"
type="file"
runat="server">
<br><br>
<input type=submit
value="Upload!"
OnServerclick="UploadBtn_Click"
runat="server">
<br><br><br>
<div id="FileDetails"
Visible=false
runat="server">
FileName: <span id="FileName" runat="server"/> <br>
ContentType: <span id="MyContentType" runat="server"/> <br>
ContentLength: <span id="ContentLength" runat="server"/>bytes
<br>
</div>
</form>
</body>
</html>