有一個上傳,
不過當我選擇的file檔案太大的時候,
本機電腦都會說找不到網頁,
不過~如果檔案小,他就會自動存進資料夾裡面,
請問我該怎麼做阿?我需要上傳空間大的~"~
程式碼如下
<!-- 程式範例:ch11-5-3.aspx -->
<%@ Page Language="VB" %>
<%@ Import Namespace="System.IO" %>
<script Runat="server">
Sub UploadMultiFiles(Sender As Object, E As EventArgs)
'取得上傳路徑
Dim uploadPath As String = Server.MapPath("Side")
'取得HttpFileCollection物件
Dim objFileCollection As HttpFileCollection = _
Request.Files
Dim file As HttpPostedFile
Dim i, counter As Integer
counter = 0
'使用迴圈取出每一個HttpPostFile物件
For i = 0 To objFileCollection.Count - 1
file = objFileCollection(i)
If file.ContentLength <> Nothing Then
'上傳檔案
file.SaveAs(uploadPath & "/" & _
Path.GetFileName(file.FileName))
counter = counter + 1
End If
Next i
msg.Text = "上傳[" & counter & "]個檔案成功.."
End Sub
</script>
<html>
<head><title>同時上傳多個檔案</title></head>
<body>
<form id="Form1" enctype="multipart/form-data" Runat="server">
<input type="File" Id="f" size="30" Runat="server"/><br/>
<input type="File" Id="f2" size="30" Runat="server"/><br/>
<asp:Button ID="Button1" OnClick="UploadMultiFiles"
Text="上傳檔案" Runat="server"/><br/>
<asp:Label Id="msg" ForeColor="blue" Runat="server"/>
</form>
</body>
</html>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.127.186.3