The application is in NET 20 using vs.2005 and FLEX that was originally in C# which I converted to VB. This whole thing started because a client wanted upload progress indicator for file uploads. It seems to happen after the file is uploaded. How asp.net works is it will cache the file while uploading and then when the full file is uploaded it then seems to copy to the upload Directory. It is at this time that it tosses the error. In firefox it gives a bit more details.
Here is what happens. Select a file to upload, File uploads and on 100% the first error box appears:
There has been an I/O Error: Error #2038: File I/O Error. URL: http://faroutcomputers/Upload.axd?
Then you click okay and the second one shows up:
There has been an HTTP Error: status code 500
Oh and another interesting thing. If I upload with IE7 I get the two errors but the file uploads and is present in the upload directory. If I upload with firefox I get the same two errors but the file does not appear in the upload directory and isn't completed.
> I am running this application on Windows server 2003 enterprise.
> IIS 6
I found this entry in event viewer on windows 2003:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 11/13/2007 6:05:01 PM
Event time (UTC): 11/13/2007 11:05:01 PM
Event ID: 8161cd1f609b436382ae30ae036145bc
Event sequence: 128
Event occurrence: 9
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/1148271820/Root/YoyoStudiosUploader2-3-128394676961048560
Trust level: Full
Application Virtual Path: /YoyoStudiosUploader2
Application Path: C:\CommercialWebsites\YoyoStudiosUploader2\
Machine name: WEBSLAVE2
Process information:
Process ID: 668
Process name: aspnet_wp.exe
Account name: WEBSLAVE2\ASPNET
Exception information:
Exception type: HttpException
Exception message: The SaveAs method is configured to require a rooted path, and the path 'Testing.avi' is not rooted.
Request information:
Request URL: http://faroutcomputers.dyndns.biz:8083/YoyoStudiosUploader2/Upload.axd
Request path: /YoyoStudiosUploader2/Upload.axd
User host address: 192.168.1.14
User:
Is authenticated: False
Authentication Type:
Thread account name: WEBSLAVE2\ASPNET
Thread information:
Thread ID: 1
Thread account name: WEBSLAVE2\ASPNET
Is impersonating: False
Stack trace: at System.Web.HttpPostedFile.SaveAs(String filename)
at Upload.ProcessRequest(HttpContext context) in C:\CommercialWebsites\YoyoStudiosUploader2\App_Code\Upload.vb:line 84
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Anyone know why this is happening?
Can you post some of the code where the error is occurring?
Hi,
Based on my understanding, when you use the FileUpload control to upload the file in your asp.net application, you get the error message above. If I have misunderstood you, please feel free to let me know.
Base on the exception message, the problem is that the HttpPostedFile.SaveAs method doesn't accept the file path that you passed.
To better understand your issue, could you please confirm the following information:
Please make sure that the path we pass is correct. We can insert the breakpoint to check.
Okay the application works FINE in IE.
Here is what happens with FIREFOX.
Select a file to upload, File uploads and on 100% the first error box appears:
There has been an I/O Error: Error #2038: File I/O Error. URL: http://faroutcomputers/Upload.axd?
Then you click okay and the second one shows up:
There has been an HTTP Error: status code 500
THIS ERROR IS SHOWN IN THE WINDOWS 2003 Event VIewer.
Exception information:
Exception type: HttpException
Exception message: The SaveAs method is configured to require a rooted path, and the path 'test.mp3' is not rooted.
Anyone know why I get an error in Firefox and IE works like a charm?
Session("FtpFolder") has a value of"C:\CommercialWebsites\mbelcher\"
and this is also shown in the trace info as being the vlaue of the session variable. IE works no issues but Firefox says no.... also Safari on a mac has the same errors as firefox.
CODE BELOW:
Imports Microsoft.VisualBasic
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.IO
Public Class Upload
Implements IHttpHandler
Implements IRequiresSessionState
Public ReadOnly Property isReusable() As Boolean _
Implements IHttpHandler.IsReusable
Get
Return True
End Get
End Property
Public Sub Upload()
End Sub
Public Sub ProcessRequest(ByVal context As HttpContext) _
Implements IHttpHandler.ProcessRequest
If context.Request.Files.Count > 0 Then
' get the applications path
Dim tempFile As String = context.Request.PhysicalApplicationPath
Dim j As Int16
' get the current file
Dim uploadFile As HttpPostedFile = context.Request.Files(0)
' if there was a file uploded
If uploadFile.ContentLength > 0 Then
' save the file to the upload directory
Dim strDirectory As String = HttpContext.Current.Session("FtpFolder")
strDirectory = HttpContext.Current.Session("FtpFolder")
uploadFile.SaveAs(String.Format("{0}{1}", strDirectory, uploadFile.FileName))
' HttpPostedFile has an InputStream also. You can pass this to
' a function, or business logic. You can save it a database:
'byte[] fileData = new byte[uploadFile.ContentLength];
'uploadFile.InputStream.Write(fileData, 0, fileData.Length);
' save byte array into database.
' something I do is extract files from a zip file by passing
' the inputStream to a function that uses SharpZipLib found here:
'http://www.icsharpcode.net/OpenSource/SharpZipLib/
' and then save the files to disk.
End If
'Next
End If
' Used as a fix for a bug in mac flash player that makes the
' onComplete event not fire
HttpContext.Current.Response.Write(" ")
End Sub
End Class
Okay the application works FINE in IE.
Here is what happens with FIREFOX.
Select a file to upload, File uploads and on 100% the first error box appears:
There has been an I/O Error: Error #2038: File I/O Error. URL: http://faroutcomputers/Upload.axd?
Then you click okay and the second one shows up:
There has been an HTTP Error: status code 500
THIS ERROR IS SHOWN IN THE WINDOWS 2003 Event VIewer.
Exception information:
Exception type: HttpException
Exception message: The SaveAs method is configured to require a rooted path, and the path 'test.mp3' is not rooted.
Anyone know why I get an error in Firefox and IE works like a charm?
Session("FtpFolder") has a value of"C:\CommercialWebsites\mbelcher\"
and this is also shown in the trace info as being the vlaue of the session variable. IE works no issues but Firefox says no.... also Safari on a mac has the same errors as firefox.
CODE BELOW:
Imports Microsoft.VisualBasicImports SystemImports System.DataImports System.ConfigurationImports System.WebImports System.Web.SecurityImports System.Web.UIImports System.Web.UI.WebControlsImports System.Web.UI.WebControls.WebPartsImports System.Web.UI.HtmlControlsImports System.IOPublic Class UploadImplements IHttpHandlerImplements IRequiresSessionStatePublic ReadOnly Property isReusable()As Boolean _Implements IHttpHandler.IsReusableGet Return True End Get End Property Public Sub Upload()End Sub Public Sub ProcessRequest(ByVal contextAs HttpContext) _Implements IHttpHandler.ProcessRequestIf context.Request.Files.Count > 0Then' get the applications pathDim tempFileAs String = context.Request.PhysicalApplicationPathDim jAs Int16' get the current fileDim uploadFileAs HttpPostedFile = context.Request.Files(0)' if there was a file uplodedIf uploadFile.ContentLength > 0Then' save the file to the upload directoryDim strDirectoryAs String = HttpContext.Current.Session("FtpFolder") strDirectory = HttpContext.Current.Session("FtpFolder") uploadFile.SaveAs(String.Format("{0}{1}", strDirectory, uploadFile.FileName))' HttpPostedFile has an InputStream also. You can pass this to ' a function, or business logic. You can save it a database: 'byte[] fileData = new byte[uploadFile.ContentLength]; 'uploadFile.InputStream.Write(fileData, 0, fileData.Length); ' save byte array into database. ' something I do is extract files from a zip file by passing ' the inputStream to a function that uses SharpZipLib found here: ' http://www.icsharpcode.net/OpenSource/SharpZipLib/ ' and then save the files to disk.End If'NextEnd If' Used as a fix for a bug in mac flash player that makes the ' onComplete event not fire HttpContext.Current.Response.Write(" ")End SubEnd Class
Hi,
Thanks for your response.
As far as I know, the FileUpload works differently in the IE and FireFox. For example, FileUpload1.PostedFile.FileName returns full path in the IE, but returns file name in the FireFox. So please check the uploadFile.FileName in the IE and FireFox. We can only get the file name with System.IO.Path.GetFileName method, such asSystem.IO.Path.GetFileName( FileUpload1.PostedFile.FileName );
I hope this helps.
So, in other words, your session variable is not set in Firefox. Is this
because you have disabled cookies in Firefox? Or are blocking them for that
site?
I checked and firefox was not blocking cookies but for some reason it wasn't getting the session information. I changed to cookeless and it works fine now in all browsers. There is another issue on a different server that I put the application on. Of course it works fine here on my development server but not on the published one. My server is a development server and is on a machine to itself and I do not work off of it. It hosts many websites all of which work fine viewed form here or out on the net.
Same exact Application, but different servers. Both are windows 2003 servers.
My site:http://faroutcomputers.dyndns.biz:8083/YoyoStudiosUploader2/ The application works fine here on all browsers and images are fine
Site with issues:http://upload.yoyostudios.com – Pictures missing very strange. Haven't seen this issue before.
0 comments:
Post a Comment