Loading ...

ASP.NET File Upload - Could not find a part of the path

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  getting started / general asp.net   » ASP.NET File Upload - Could not find a part of the path

ASP.NET File Upload - Could not find a part of the path

Posts under the topic: ASP.NET File Upload - Could not find a part of the path

Posted: 11/19/2009

Lurker 192  points  Lurker
  • Joined on: 10/23/2009
  • Posts: 20

I am performing an image upload from a local machine to an Image Stream.

It works locally all the time but now since my site was deployed to the server it works intermediately to the deployed it. I wanted to find out if anyone else has experienced this issue and resolution.

Steps
1. Use the .NET 2.0 FileUpload server control to upload a file.
2. In the C# code behind convert to byte
3. Insert into SQL Server

Code
//Convert to stream
Stream ImgStream = FileUpload1.PostedFile.InputStream;
int ImgLen = FileUpload1.PostedFile.ContentLength;
string ImgContentType = FileUpload1.PostedFile.ContentType;

//Convert to byte
byte[] ImgBinaryData = new byte[ImgLen];
int n = ImgStream.Read(ImgBinaryData, 0, ImgLen);

//Insert the image
UpdateImage(ImgBinaryData, ImgContentType, TxtAltText.Text.Trim(), FileUploadName);

Error

This error is thrown from time to time. It can be the same or a different image used for uploading

Message: Could not find a part of the path 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Tem porary ASP.NET Files\root\0fce6ce6\807dd878\uploads\9ghvrc8j.tmp' .

Method Caused Error: Void WinIOError(Int32, System.String)

Stack Trace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)%0d%0a at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)%0d%0a at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)%0d%0a at System.CodeDom.Compiler.TempFileCollection.EnsureT empNameCreated()%0d%0a at System.CodeDom.Compiler.TempFileCollection.AddExte nsion(String fileExtension, Boolean keepFile)%0d%0a at System.Web.HttpRawUploadedContent.TempFile..ctor() %0d%0a at System.Web.HttpRawUploadedContent.AddBytes(Byte[] data, Int32 offset, Int32 length)%0d%0a at System.Web.HttpRequest.GetEntireRawContent()%0d%0a at System.Web.HttpRequest.GetMultipartContent()%0d%0a at System.Web.HttpRequest.FillInFormCollection()%0d%0 a at System.Web.HttpRequest.get_Form()%0d%0a at System.Web.HttpRequest.get_HasForm()%0d%0a at System.Web.UI.Page.GetCollectionBasedOnMethod(Bool ean dontReturnNull)%0d%0a at System.Web.UI.Page.DeterminePostBackMode()%0d%0a at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Thanks

Naval Kishor Pandey


tags ASP.NET

Posted: 11/29/2009

Guru 16813  points  Guru
  • Joined on: 4/19/2009
  • Posts: 490
  Answered

naval198409 said:

This error is thrown from time to time. It can be the same or a different image used for uploading

Message: Could not find a part of the path 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Tem porary ASP.NET Files\root\0fce6ce6\807dd878\uploads\9ghvrc8j.t

 

It clearly shows path does not exist, have you checked on the server for the existance of this path.


Page 1 of 1 (2 items)