I just can't seem to figure this out. I'm doing a file upload and it works perfectly on my dev machine - but I get a "Object reference not set to an instance of an object". I would use the URLControl class but I'm automatically resizing images on upload too. Can anyone help?
<
input id="myFile" type="file" runat="server" class="CommandButton"/>
<input id="Button1" type="button" value="Upload" onserverclick="Upload" runat="server" class="CommandButton" />
Any help would be greatly appreciated!
Here's the Upload event:
Sub Upload(ByVal sender As System.Object, ByVal e As
System.EventArgs)
If Not (myFile.PostedFile Is Nothing)
Then
Dim intFileNameLength As Integer
Dim strFileNamePath As String
Dim strFileNameOnly As String
intFileNameLength = InStr(1, StrReverse(strFileNamePath),
strFileNameOnly = Mid(strFileNamePath, (Len(strFileNamePath) - intFileNameLength) + 2)
strFileNamePath = myFile.PostedFile.FileName"\")Dim Size As Integer = 400Dim bmp As Bitmap = CreateThumbnail(strFileNamePath, Size, Size)If bmp Is String.Empty Then
Me.ErrorResult()Return
End If
OutputFilename = Request.QueryString(
Dim OutputFilename As String = String.Empty"OutputFilename")
End If
Response.ContentType =
"image/jpeg"
bmp.Save(Response.OutputStream, System.Drawing.Imaging.Imageformat.Jpeg)
bmp.Save(Server.MapPath(Request.ApplicationPath) +
strFileNameOnly =
SaveImage(strFileNameOnly)
"images\" + strFileNameOnly, Imageformat.Jpeg)bmp.Dispose()"images\" & strFileNameOnlyEnd If