[2005]File access in directory vs. direct from file upload dialog box
I have an onSubmit event that takes an image from a file upload dialog box and manipulates it. However, I seem to only be able to manipulate the image file once it is downloaded into my temp directory. I'd like to be able to bypass the writing of this file to the temp dir and manipulate it directly.The following is a block of code that writes the file to a temp directory and successfully accesses it for manipulation. Note the highlighted line:
VB Code:
Dim UploadedFile As String = MyFile.PostedFile.FileName
Dim ExtractPos As Int16 = UploadedFile.LastIndexOf("\") + 1
Dim UploadedFileName As String = UploadedFile.Substring(ExtractPos, UploadedFile.Length - ExtractPos)
MyFile.PostedFile.SaveAs(Request.PhysicalApplicationPath + "pics\" + UploadedFileName)
Dim imageUrl As String = UploadedFileName
imageUrl = "pics\" + imageUrl
[COLOR=Blue]Dim fullSizeImg As System.Drawing.Image = System.Drawing.Image.FromFile(Server.MapPath(imageUrl)) [/COLOR]
Now, this is the what I tried applying:
VB Code:
Dim UploadedFile As String = MyFile.PostedFile.FileName
Dim ExtractPos As Int16 = UploadedFile.LastIndexOf("\") + 1
Dim UploadedFileName As String = UploadedFile.Substring(ExtractPos, UploadedFile.Length - ExtractPos)
MyFile.PostedFile.SaveAs(Request.PhysicalApplicationPath + "pics\" + UploadedFileName)
Dim imageUrl As String = UploadedFileName
imageUrl = "pics\" + imageUrl
[COLOR=Red]Dim fullSizeImg As System.Drawing.Image = System.Drawing.Image.FromFile(UploadedFile)) [/COLOR]
Strangely enough, this code does indeed work the way it is 'supposed' to work when run using my ASP development server. However, when this page is uploaded and run online, I get an unhandled exception: System.IO.FileNotFoundException
How can I get this to work?