Forums
This topic is locked
Limited size upload
27 Jan 2004 15:11:56 D J posted:
I want to make a limit on my upload script (size and filetype). I've looked around but every body seems to use pure asp upload. I don't. (I've used ASP.NET) is there anybody that can help??This is my script:
Sub MultiUpload_Clicked(ByVal Sender As Object, ByVal e As EventArgs)
Dim Resultaat As String
Dim SFilename As String
Dim SFoldername As String = "D:\david\Asp_punt_net\test39\"
Dim SobjFile As HttpPostedFile
Dim i As Integer
Dim s As String
Try
For i = 0 To Request.Files.Count - 1
SobjFile = Request.Files(i)
If Not (SobjFile Is Nothing Or SobjFile.Filename = "" Or SobjFile.ContentLength < 1) Then
SFilename = SobjFile.FileName
SFilename = Path.GetFileName(SFilename)
If (Not Directory.Exists(SFoldername)) Then
Directory.CreateDirectory(SFoldername)
End If
SobjFile.SaveAs(SFoldername & SFilename)
Resultaat = Resultaat & "Bestand: " & SobjFile.FileName & " is opgeslagen.<br> "
UploadForm.Visible = False
End If
Next
If Resultaat = "" Then
Resultaat = "Selecteer minimaal 1 bestand."
End If
Catch errorVariable As Exception
Resultaat = errorVariable.ToString()
End Try
ResultMsg.Visible = True
ResultMsg.Text = Resultaat
End Sub
Thanks!! David
Edited by - d-dayve on 27 Jan 2004 15:17:02