B
Brian Pittman
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.PostedFile Is Nothing) Then
Dim tw As TextWriter
Dim r As HttpResponse = New HttpResponse(tw)
Try
inputFile.PostedFile.SaveAs(destination)
success = True
Catch exc As Exception
' r is a reference to httpResponse Object
r.Write("Execption Message: " & exc.Message.ToString() &
"<br />")
r.Write("Execption Source: " & exc.Source.ToString())
r.Write("Execption 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.PostedFile Is Nothing) Then
Dim tw As TextWriter
Dim r As HttpResponse = New HttpResponse(tw)
Try
inputFile.PostedFile.SaveAs(destination)
success = True
Catch exc As Exception
' r is a reference to httpResponse Object
r.Write("Execption Message: " & exc.Message.ToString() &
"<br />")
r.Write("Execption Source: " & exc.Source.ToString())
r.Write("Execption Stack: " & exc.StackTrace.ToString())
success = False
End Try
Return success
End If
End Function