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
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