Upload large data


H

Husam

hi everybody:

I have the follwing code that I used it to upload data to my web site:

the code:

Sub SaveFile(ByVal file As HttpPostedFile)
Dim savePath As String =
Hosting.HostingEnvironment.ApplicationPhysicalPath + "UserArea\"
Dim fileName As String = FileUpload1.FileName
Dim pathToCheck As String = savePath + fileName
Dim tempfileName As String
' Check to see if a file already exists with the
' same name as the file to upload.
If (System.IO.File.Exists(pathToCheck)) Then
Dim counter As Integer = 2
While (System.IO.File.Exists(pathToCheck))
' If a file with this name already exists,
' prefix the filename with a number.
tempfileName = counter.ToString() + fileName
pathToCheck = savePath + tempfileName
counter = counter + 1
End While
fileName = tempfileName
' Notify the user that the file name was changed.
UploadStatusLabel.Text = "A file with the same name already
exists." + "<br>" + _
"Your file was saved as " + fileName
Else
' Notify the user that the file was saved successfully.
UploadStatusLabel.Text = "Your file was uploaded successfully."
End If
' Append the name of the file to upload to the path.
savePath += fileName
' Call the SaveAs method to save the uploaded
' file to the specified directory.
FileUpload1.SaveAs(savePath)
End Sub

And for button to upload this code:

If (FileUpload1.HasFile) Then
' Call a helper method routine to save the file.
SaveFile(FileUpload1.PostedFile)
Else
' Notify the user that a file was not uploaded.
UploadStatusLabel.Text = "You did not specify a file to upload."
End If
and at web.Config I had that setting:

<httpRuntime executionTimeout="18000" maxRequestLength="2097151"/>

The problem is when I work with small data everthing is right but when I
work with data more than 200 mb like 345 mb I can not upload these data?

is there some one can help me or direct me abpout this situation?

any help will be appreciated regard's

Husam
 
Ad

Advertisements

M

Munna

hi everybody:

I have the follwing code that I used it to upload data to my web site:

the code:

Sub SaveFile(ByVal file As HttpPostedFile)
Dim savePath As String =
Hosting.HostingEnvironment.ApplicationPhysicalPath + "UserArea\"
Dim fileName As String = FileUpload1.FileName
Dim pathToCheck As String = savePath + fileName
Dim tempfileName As String
' Check to see if a file already exists with the
' same name as the file to upload.
If (System.IO.File.Exists(pathToCheck)) Then
Dim counter As Integer = 2
While (System.IO.File.Exists(pathToCheck))
' If a file with this name already exists,
' prefix the filename with a number.
tempfileName = counter.ToString() + fileName
pathToCheck = savePath + tempfileName
counter = counter + 1
End While
fileName = tempfileName
' Notify the user that the file name was changed.
UploadStatusLabel.Text = "A file with the same name already
exists." + "<br>" + _
"Your file was saved as " + fileName
Else
' Notify the user that the file was saved successfully.
UploadStatusLabel.Text = "Your file was uploaded successfully."
End If
' Append the name of the file to upload to the path.
savePath += fileName
' Call the SaveAs method to save the uploaded
' file to the specified directory.
FileUpload1.SaveAs(savePath)
End Sub

And for button to upload this code:

If (FileUpload1.HasFile) Then
' Call a helper method routine to save the file.
SaveFile(FileUpload1.PostedFile)
Else
' Notify the user that a file was not uploaded.
UploadStatusLabel.Text = "You did not specify a file to upload."
End If
and at web.Config I had that setting:

<httpRuntime executionTimeout="18000" maxRequestLength="2097151"/>

The problem is when I work with small data everthing is right but when I
work with data more than 200 mb like 345 mb I can not upload these data?

is there some one can help me or direct me abpout this situation?

any help will be appreciated regard's

Husam

Hi

Normally the max size of a httpwebupload is 4 mb and is defined in
machine.config file of webserver
to increase and override default the size of the maxrequest size go to
web.confiq just add
<httpRuntime maxRequestLength="1048576" /> under system.web section

Best of luck

Munna
www.munna.shatkotha.com
www.munna.shatkotha.com/blog
www.shatkotha.com
 
Ad

Advertisements

R

Riki

Husam said:
hi everybody:

I have the follwing code that I used it to upload data to my web site:

the code:

Sub SaveFile(ByVal file As HttpPostedFile)
Dim savePath As String =
Hosting.HostingEnvironment.ApplicationPhysicalPath + "UserArea\"
Dim fileName As String = FileUpload1.FileName
Dim pathToCheck As String = savePath + fileName
Dim tempfileName As String
' Check to see if a file already exists with the
' same name as the file to upload.
If (System.IO.File.Exists(pathToCheck)) Then
Dim counter As Integer = 2
While (System.IO.File.Exists(pathToCheck))
' If a file with this name already exists,
' prefix the filename with a number.
tempfileName = counter.ToString() + fileName
pathToCheck = savePath + tempfileName
counter = counter + 1
End While
fileName = tempfileName
' Notify the user that the file name was changed.
UploadStatusLabel.Text = "A file with the same name already
exists." + "<br>" + _
"Your file was saved as " +
fileName Else
' Notify the user that the file was saved successfully.
UploadStatusLabel.Text = "Your file was uploaded
successfully." End If
' Append the name of the file to upload to the path.
savePath += fileName
' Call the SaveAs method to save the uploaded
' file to the specified directory.
FileUpload1.SaveAs(savePath)
End Sub

And for button to upload this code:

If (FileUpload1.HasFile) Then
' Call a helper method routine to save the file.
SaveFile(FileUpload1.PostedFile)
Else
' Notify the user that a file was not uploaded.
UploadStatusLabel.Text = "You did not specify a file to
upload." End If
and at web.Config I had that setting:

<httpRuntime executionTimeout="18000" maxRequestLength="2097151"/>

The problem is when I work with small data everthing is right but
when I work with data more than 200 mb like 345 mb I can not upload
these data?

is there some one can help me or direct me abpout this situation?

any help will be appreciated regard's

Husam

When web.config says that maxRequestLength="2097151" (bytes), it is normal
that the limit is 200MB.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top