Hi,
I was wondering how to go about creating a wrapper function for uploading
files to the server? I have made an attempt on my own without success. I
don't get any exceptions from the function but It doens't upload the file
either. Any help is appreciated.
Brian
'************** *******
'** Code Snip
'************** *******
Function HtmlFileUpload( ByVal inputFile As HtmlInputFile, _
ByVal destination As String) As Boolean
'
Dim contentLength As Integer
inputFile = New HtmlInputFile()
Dim success As Boolean = False
Dim contentType As String
If (Not inputFile.Poste dFile Is Nothing) Then
Dim tw As TextWriter
Dim r As HttpResponse = New HttpResponse(tw )
Try
inputFile.Poste dFile.SaveAs(de stination)
success = True
Catch exc As Exception
' r is a reference to httpResponse Object
r.Write("Execpt ion Message: " & exc.Message.ToS tring() &
"<br />")
r.Write("Execpt ion Source: " & exc.Source.ToSt ring())
r.Write("Execpt ion Stack: " & exc.StackTrace. ToString())
success = False
End Try
Return success
End If
End Function
I was wondering how to go about creating a wrapper function for uploading
files to the server? I have made an attempt on my own without success. I
don't get any exceptions from the function but It doens't upload the file
either. Any help is appreciated.
Brian
'************** *******
'** Code Snip
'************** *******
Function HtmlFileUpload( ByVal inputFile As HtmlInputFile, _
ByVal destination As String) As Boolean
'
Dim contentLength As Integer
inputFile = New HtmlInputFile()
Dim success As Boolean = False
Dim contentType As String
If (Not inputFile.Poste dFile Is Nothing) Then
Dim tw As TextWriter
Dim r As HttpResponse = New HttpResponse(tw )
Try
inputFile.Poste dFile.SaveAs(de stination)
success = True
Catch exc As Exception
' r is a reference to httpResponse Object
r.Write("Execpt ion Message: " & exc.Message.ToS tring() &
"<br />")
r.Write("Execpt ion Source: " & exc.Source.ToSt ring())
r.Write("Execpt ion Stack: " & exc.StackTrace. ToString())
success = False
End Try
Return success
End If
End Function
Comment