T
tshad
oThumbnail.Save is giving me an error:
System.Runtime.InteropServices.ExternalException: A generic error occurred
in GDI+.
theFileName = New FileInfo(strFileName)
fileOut = fileIn.Substring(0,fileIn.LastIndexOf(".")) &
session("User").CompanyID & fileIn.Substring(fileIn.LastIndexOf("."))
pathFileOut = Server.MapPath("\Uploads") & "\" &
fileIn.Substring(0,fileIn.LastIndexOf(".")) & "Temp" &
fileIn.Substring(fileIn.LastIndexOf("."))
MyFile2.PostedFile.SaveAs(PathFileOut)
' Write out a temporary file that will be read back in for thumbnail
Dim oImage As System.Drawing.Image
oImage = oImage.FromFile(pathFileOut)
' Read back in File, create thumbnail and save it
Dim oThumbnail as System.Drawing.Image
oThumbnail = oImage.GetThumbnailImage(100,200,Nothing,Nothing)
thumbnailFileOut = Server.MapPath("\Uploads") & "\" &
fileIn.Substring(0,fileIn.LastIndexOf(".")) &
fileIn.Substring(fileIn.LastIndexOf("."))
oThumbnail.Save(Server.MapPath("uploads") & "\" & fileOut,
ImageFormat.Jpeg)
I am getting the error on the last line.
The path and filename are valid - what causes the problem here?
Thanks,
Tom
System.Runtime.InteropServices.ExternalException: A generic error occurred
in GDI+.
theFileName = New FileInfo(strFileName)
fileOut = fileIn.Substring(0,fileIn.LastIndexOf(".")) &
session("User").CompanyID & fileIn.Substring(fileIn.LastIndexOf("."))
pathFileOut = Server.MapPath("\Uploads") & "\" &
fileIn.Substring(0,fileIn.LastIndexOf(".")) & "Temp" &
fileIn.Substring(fileIn.LastIndexOf("."))
MyFile2.PostedFile.SaveAs(PathFileOut)
' Write out a temporary file that will be read back in for thumbnail
Dim oImage As System.Drawing.Image
oImage = oImage.FromFile(pathFileOut)
' Read back in File, create thumbnail and save it
Dim oThumbnail as System.Drawing.Image
oThumbnail = oImage.GetThumbnailImage(100,200,Nothing,Nothing)
thumbnailFileOut = Server.MapPath("\Uploads") & "\" &
fileIn.Substring(0,fileIn.LastIndexOf(".")) &
fileIn.Substring(fileIn.LastIndexOf("."))
oThumbnail.Save(Server.MapPath("uploads") & "\" & fileOut,
ImageFormat.Jpeg)
I am getting the error on the last line.
The path and filename are valid - what causes the problem here?
Thanks,
Tom