Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > the process cannot access the file because it is being used by another process

Reply
Thread Tools

the process cannot access the file because it is being used by another process

 
 
bala
Guest
Posts: n/a
 
      04-07-2005
Hi All,
Sorry for repost

I have a popup for image upload with a upload button,save button and one
close button
I am uploading images with a file control after browsing when I click on
upload button it
upload the file to some folder /xyz/temp/ folder with name 101.jpg
now i close the popup.
now when i again open and try to upload (upload the file to same folder
/xyz/temp/ folder with name 101.jpg)
it gives me exception on this line
inputFile.SaveAs(MapPath(/tmp+"//"+fileName));
saying
"the process cannot access the file (101.jpg)because it is being used by
another process"
this exception is thrown.
now if i restart the asp.net worker process this exception doesnt comes
that mean the file is cached in memory by the asp.net worker process.

Thanks in advance
bala


 
Reply With Quote
 
 
 
 
Patrick Olurotimi Ige
Guest
Posts: n/a
 
      04-07-2005
Are u releasing it?
Patrick


*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
bala
Guest
Posts: n/a
 
      04-07-2005
Hi

Thank for the reply

I am not geeting what to release the file

I m creating a object of HttpPostedFile

After use I am setting it to null

There is no property like dispose with it

I m sending u the code fragment

On postback

if(IsPostBack)

{HttpPostedFile uploadedFile = file.PostedFile;

try

{if(uploadedFile.ContentType=="image/pjpeg")

{uploadedFile.saveas(path+"101.jpg");

uploadedFile=null;

}}

Catch(){}

When user clicks on preview I am creating a datatable contains the

ImageUrl and Image(typeof(byte[])

Now I am displaying the image in pdf formate in another frame

I am not geeting what to release the file

thanks

bala



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot delete a file the process cannot access the file because it is being used by another process ASp.net 2 ary ASP .Net 2 11-29-2006 04:30 AM
Cannot delete a file the process cannot access the file because it is being used by another process ASp.net 2 ary ASP .Net 0 11-28-2006 09:13 AM
Process Cannot access file "file_name" because it is being used by another process Rithesh Pai ASP .Net 1 08-22-2005 03:02 PM
Cannot Copy Assembly <MyAssembly> The Process Cannot Access The File Because It Is Being Used By Another Process Ram ASP .Net 2 06-30-2005 11:30 AM
delete file failed, The process cannot access the file because it is being used by another process guoqi zheng ASP .Net 3 04-13-2005 06:17 PM



Advertisments