473,395 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Can't delete file after upload.

Hi there

I am having trouble deleting an uploaded file that I have just written to
disc. I am using the SaveAs method of a HttpPostedFile to write the file to
disc, then straight after I'm trying to use kill(FILE) to delete it. I
get the error "The process cannot access the file "FILE.JPG" because it is
being used by another process."
If I use the Explorer-program to try and delete the file afterwards I get
the error "Cannot delete FILE.JPG: There has been a sharing violation. The
source or destination file may be in use"

Does anyone have a solution?

Best regards

Michael K.
Nov 19 '05 #1
4 3758
Hi Michael:

Could you post the method where you save the file?

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Sat, 18 Dec 2004 12:09:02 -0800, "Michael K."

<Mi******@discussions.microsoft.com> wrote:
Hi there

I am having trouble deleting an uploaded file that I have just written to
disc. I am using the SaveAs method of a HttpPostedFile to write the file to
disc, then straight after I'm trying to use kill(FILE) to delete it. I
get the error "The process cannot access the file "FILE.JPG" because it is
being used by another process."
If I use the Explorer-program to try and delete the file afterwards I get
the error "Cannot delete FILE.JPG: There has been a sharing violation. The
source or destination file may be in use"

Does anyone have a solution?

Best regards

Michael K.


Nov 19 '05 #2
Well Michael i have exactly the same kind of application and mine works just
fine..
Try posting ur code..
Patrick

"Michael K." wrote:
Hi there

I am having trouble deleting an uploaded file that I have just written to
disc. I am using the SaveAs method of a HttpPostedFile to write the file to
disc, then straight after I'm trying to use kill(FILE) to delete it. I
get the error "The process cannot access the file "FILE.JPG" because it is
being used by another process."
If I use the Explorer-program to try and delete the file afterwards I get
the error "Cannot delete FILE.JPG: There has been a sharing violation. The
source or destination file may be in use"

Does anyone have a solution?

Best regards

Michael K.

Nov 19 '05 #3
Hi Patrick

I have found the error. After upload I do some resizing of the uploaded
picture and it was this function which locked the file. :-/

Sorry for your interuption.

Best regards
Michael K

"Patrick.O.Ige" wrote:
Well Michael i have exactly the same kind of application and mine works just
fine..
Try posting ur code..
Patrick

"Michael K." wrote:
Hi there

I am having trouble deleting an uploaded file that I have just written to
disc. I am using the SaveAs method of a HttpPostedFile to write the file to
disc, then straight after I'm trying to use kill(FILE) to delete it. I
get the error "The process cannot access the file "FILE.JPG" because it is
being used by another process."
If I use the Explorer-program to try and delete the file afterwards I get
the error "Cannot delete FILE.JPG: There has been a sharing violation. The
source or destination file may be in use"

Does anyone have a solution?

Best regards

Michael K.

Nov 19 '05 #4
Nice one Michael..
Good ur found ur Error..
Enjoy .Net
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: lawrence | last post by:
I've two scripts, one to upload images, another to delete them. The upload script works fine, but the delete script has permissions trouble. How can PHP not have permission to delete an image it...
18
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
3
by: LisaBigJax | last post by:
I am utilizing the ASP.net FileUpload control to upload a file. After upload, if a user tries to delete the file, I get the dreaded The process cannot access the file...
0
by: smanisankar | last post by:
hi, the following is the full page code for uploading a file to server. since i got no idea to overwrite the file, i want delete the file if the file is already uploaded. i got the folder name...
0
by: foekall | last post by:
I used this script and test on my hosting. Evertimes appear "change permission to 777 failed. ". So, how to solve this error. Please kindly check for me and teach me. <?php $MAX_SIZE =...
1
by: alexseow | last post by:
How can i update picture based on id i submitted <%Option Explicit%> <!-- #include file="../../includes/dbconn.asp"--> <HTML> <BODY> <HTML> <BODY> <%
5
by: maheswaran | last post by:
Hi, i have issue in FTP , i have tried with .net and also c# Note the following scenario: 1. Upload the file to FTP >than 60 MB. 2. At the time of Uploading, unplug the LAN cable (or)...
1
by: achotto | last post by:
hi, i try to upload a multiple image files. after that i will rename the files name. the problem is when i upload a 2 or more same files name exp-goal.jpg, it will return "files already exist". ok...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.