Need help to upload 500 MB file on FTP
-
I am having problem in Uploading 500 MB File on web server can anyone help me
Private Function UploadToFTP(ByVal fileToUpload As HttpPostedFile) As Boolean
Try
Dim uploadUrl As String = "ftp://........................."
Dim uploadFileName As String = fileToUpload.FileNameDim streamObj As Stream = fileToUpload.InputStream
Dim buffer As [Byte]() = New [Byte](fileToUpload.ContentLength - 1) {}
streamObj.Read(buffer, 0, buffer.Length)
streamObj.Close()
streamObj = NothingDim ftpUrl As String = String.Format("{0}/{1}", uploadUrl, uploadFileName)
Dim requestObj As FtpWebRequest = TryCast(FtpWebRequest.Create(ftpUrl), FtpWebRequest)
requestObj.Method = WebRequestMethods.Ftp.UploadFile
requestObj.Credentials = New NetworkCredential("UserID", "Password")
Dim requestStream As Stream = requestObj.GetRequestStream()
requestStream.Write(buffer, 0, buffer.Length)
requestStream.Flush()
requestStream.Close()
requestObj = NothingReturn True
Catch ex As Exception
Return False
End Try
End Function -
I am having problem in Uploading 500 MB File on web server can anyone help me
Private Function UploadToFTP(ByVal fileToUpload As HttpPostedFile) As Boolean
Try
Dim uploadUrl As String = "ftp://........................."
Dim uploadFileName As String = fileToUpload.FileNameDim streamObj As Stream = fileToUpload.InputStream
Dim buffer As [Byte]() = New [Byte](fileToUpload.ContentLength - 1) {}
streamObj.Read(buffer, 0, buffer.Length)
streamObj.Close()
streamObj = NothingDim ftpUrl As String = String.Format("{0}/{1}", uploadUrl, uploadFileName)
Dim requestObj As FtpWebRequest = TryCast(FtpWebRequest.Create(ftpUrl), FtpWebRequest)
requestObj.Method = WebRequestMethods.Ftp.UploadFile
requestObj.Credentials = New NetworkCredential("UserID", "Password")
Dim requestStream As Stream = requestObj.GetRequestStream()
requestStream.Write(buffer, 0, buffer.Length)
requestStream.Flush()
requestStream.Close()
requestObj = NothingReturn True
Catch ex As Exception
Return False
End Try
End FunctionYou're missing a call to
GetResponse
on theFtpWebRequest
instance. The request won't be sent until you callGetResponse
.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
You're missing a call to
GetResponse
on theFtpWebRequest
instance. The request won't be sent until you callGetResponse
.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
what is it
-
what is it
silentspeaker wrote:
what is it
What is what? :confused:
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
silentspeaker wrote:
what is it
What is what? :confused:
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
I dont know how to add it. Need assistance here
-
I dont know how to add it. Need assistance here
Something like this:
Private Function UploadToFTP(ByVal fileToUpload As HttpPostedFile) As Boolean
Try
Dim uploadUrl As String = "ftp://........................."
Dim uploadFileName As String = fileToUpload.FileNameUsing streamObj As Stream = fileToUpload.InputStream Dim buffer As \[Byte\]() = New \[Byte\](fileToUpload.ContentLength - 1) {} streamObj.Read(buffer, 0, buffer.Length) End Using Dim ftpUrl As String = String.Format("{0}/{1}", uploadUrl, uploadFileName) Dim requestObj As FtpWebRequest = TryCast(FtpWebRequest.Create(ftpUrl), FtpWebRequest) requestObj.Method = WebRequestMethods.Ftp.UploadFile requestObj.Credentials = New NetworkCredential("UserID", "Password") Using requestStream As Stream = requestObj.GetRequestStream() requestStream.Write(buffer, 0, buffer.Length) requestStream.Flush() End Using Using responseObj As FtpWebResponse = TryCast(requestObj.GetResponse(), FtpWebResponse) ' TODO: Look at responseObj.StatusCode to see if the upload succeeded End Using Return True
Catch ex As Exception
Return False
End Try
End Function
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Something like this:
Private Function UploadToFTP(ByVal fileToUpload As HttpPostedFile) As Boolean
Try
Dim uploadUrl As String = "ftp://........................."
Dim uploadFileName As String = fileToUpload.FileNameUsing streamObj As Stream = fileToUpload.InputStream Dim buffer As \[Byte\]() = New \[Byte\](fileToUpload.ContentLength - 1) {} streamObj.Read(buffer, 0, buffer.Length) End Using Dim ftpUrl As String = String.Format("{0}/{1}", uploadUrl, uploadFileName) Dim requestObj As FtpWebRequest = TryCast(FtpWebRequest.Create(ftpUrl), FtpWebRequest) requestObj.Method = WebRequestMethods.Ftp.UploadFile requestObj.Credentials = New NetworkCredential("UserID", "Password") Using requestStream As Stream = requestObj.GetRequestStream() requestStream.Write(buffer, 0, buffer.Length) requestStream.Flush() End Using Using responseObj As FtpWebResponse = TryCast(requestObj.GetResponse(), FtpWebResponse) ' TODO: Look at responseObj.StatusCode to see if the upload succeeded End Using Return True
Catch ex As Exception
Return False
End Try
End Function
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
HTTP Error 404.13 - Not Found
The request filtering module is configured to deny a request that exceeds the request content length. -
HTTP Error 404.13 - Not Found
The request filtering module is configured to deny a request that exceeds the request content length.That's not a problem uploading the file to the FTP site; it's a problem uploading the file to your ASP.NET page. You'll need to change the IIS configuration to allow large uploads. http://weblogs.asp.net/jgalloway/archive/2008/01/08/large-file-uploads-in-asp-net.aspx[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
I am having problem in Uploading 500 MB File on web server can anyone help me
Private Function UploadToFTP(ByVal fileToUpload As HttpPostedFile) As Boolean
Try
Dim uploadUrl As String = "ftp://........................."
Dim uploadFileName As String = fileToUpload.FileNameDim streamObj As Stream = fileToUpload.InputStream
Dim buffer As [Byte]() = New [Byte](fileToUpload.ContentLength - 1) {}
streamObj.Read(buffer, 0, buffer.Length)
streamObj.Close()
streamObj = NothingDim ftpUrl As String = String.Format("{0}/{1}", uploadUrl, uploadFileName)
Dim requestObj As FtpWebRequest = TryCast(FtpWebRequest.Create(ftpUrl), FtpWebRequest)
requestObj.Method = WebRequestMethods.Ftp.UploadFile
requestObj.Credentials = New NetworkCredential("UserID", "Password")
Dim requestStream As Stream = requestObj.GetRequestStream()
requestStream.Write(buffer, 0, buffer.Length)
requestStream.Flush()
requestStream.Close()
requestObj = NothingReturn True
Catch ex As Exception
Return False
End Try
End FunctionYou need to tell us what web server your using, IIS6 requires the metabase editor to change one of the values, I think max request length, under IIS/Defaults. So you can change the value in Web.config, but the metabase supersedes the web.config overall. IIS7 was a e bit easier it doesn't use metabase, there's a config file in IISAdmin folder, in system32, that you just edit. After you edit it, I think it changes a more complex structure in the background. [Edit] I messed with the upload limit for years, and tried everything, but the limit is the limit. I'm not sure about FTP, I have changed my servers to 1 gig, which is the limit for Server 2003, but you have to login to do it. I ended up using Uploadify, which works pretty good. The metabase editor is available in the IIS resource kit, an old download from microsoft.
-
I am having problem in Uploading 500 MB File on web server can anyone help me
Private Function UploadToFTP(ByVal fileToUpload As HttpPostedFile) As Boolean
Try
Dim uploadUrl As String = "ftp://........................."
Dim uploadFileName As String = fileToUpload.FileNameDim streamObj As Stream = fileToUpload.InputStream
Dim buffer As [Byte]() = New [Byte](fileToUpload.ContentLength - 1) {}
streamObj.Read(buffer, 0, buffer.Length)
streamObj.Close()
streamObj = NothingDim ftpUrl As String = String.Format("{0}/{1}", uploadUrl, uploadFileName)
Dim requestObj As FtpWebRequest = TryCast(FtpWebRequest.Create(ftpUrl), FtpWebRequest)
requestObj.Method = WebRequestMethods.Ftp.UploadFile
requestObj.Credentials = New NetworkCredential("UserID", "Password")
Dim requestStream As Stream = requestObj.GetRequestStream()
requestStream.Write(buffer, 0, buffer.Length)
requestStream.Flush()
requestStream.Close()
requestObj = NothingReturn True
Catch ex As Exception
Return False
End Try
End Function