Hi Everyone,
I'm looking for a free solution to upload large files via a web interface. Documents could be as large as 1GB.
I have some working code that will upload files:
The above works great for small files, but anything larger than 1MB seems to fail. I need to be able to upload some large images used for high definition printing.
Any help would be greatly appreciated.
I hope you find this post helpful.
Regards,
Mark
I'm looking for a free solution to upload large files via a web interface. Documents could be as large as 1GB.
I have some working code that will upload files:
Code:
<%@ Page Language="VB" %>
<script runat="server">
' Insert page code here
'
Sub Upload_Click(Sender as Object, e as EventArgs)
Dim FileName
Dim FileContent
Dim FileSize
Dim Span1
Dim Span2
' Display properties of the uploaded file
FileName.InnerHtml = MyFile.PostedFile.FileName
FileContent.InnerHtml = MyFile.PostedFile.ContentType
FileSize.InnerHtml = MyFile.PostedFile.ContentLength
UploadDetails.visible = True
'Grab the file name from its fully qualified path at client
Dim strFileName as string = MyFile.PostedFile.FileName
' only the attched file name not its path
Dim c as string = System.IO.Path.GetFileName(strFileName)
'Save uploaded file to server at C:\ServerFolder\
Try
MyFile.PostedFile.SaveAs("C:\Documents and Settings\mmaclachlan\My Documents\webmatrix\imcraft\Files\" + c)
Span1.InnerHtml = "Your File Uploaded Sucessfully at server as: " & _
"C:\Documents and Settings\mmaclachlan\My Documents\webmatrix\imcraft\Files\" & c
Catch Exp as exception
Span1.InnerHtml = "An Error occured. Please check the attached file"
UploadDetails.visible = false
Span2.visible=false
End Try
End Sub
</script>
<html>
<head>
</head>
<body>
<%-- The Web Form with the EncType property set to Multipart/Form-Data --%>
<form method="post" enctype="multipart/form-data" runat="Server">
<%-- The File upload Html control --%>Choose Your File To Upload
<br />
<input id="MyFile" type="file" runat="Server" />
<br />
<%-- A button - when clicked the form is submitted and the
Upload_Click event handler is fired... --%>
<input type="submit" value="Upload" runat="Server" onserverclick="Upload_Click" />
...
</form>
</body>
</html>
The above works great for small files, but anything larger than 1MB seems to fail. I need to be able to upload some large images used for high definition printing.
Any help would be greatly appreciated.
I hope you find this post helpful.
Regards,
Mark