473,471 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Deleting a file

Hi All,
Using a webpage I am uploading the file onto webserver. First time
it works fine. If I use the same file from second time it throws an
error.

Error:
"The process cannot access the file "<FileName>" because it is being
used by another process."

My code is as follows:
If Not (File1.PostedFile Is Nothing) Then
' Create new directory if not present
If Not (Directory.Exists(strDirPath)) Then
Directory.CreateDirectory(strDirPath)
End If

' Save the uploaded file in the directory
File1.PostedFile.SaveAs(strDirPath + "\" + strFileName)
End If
Any suggestions would be appreciated.
Regards
Sobhan

Nov 19 '05 #1
1 1099
Try looking through this article at :-
http://www.codeproject.com/aspnet/WebFileManager.asp
Sure it would help!!
Patrick


"Sobhan Vezzu" wrote:
Hi All,
Using a webpage I am uploading the file onto webserver. First time
it works fine. If I use the same file from second time it throws an
error.

Error:
"The process cannot access the file "<FileName>" because it is being
used by another process."

My code is as follows:
If Not (File1.PostedFile Is Nothing) Then
' Create new directory if not present
If Not (Directory.Exists(strDirPath)) Then
Directory.CreateDirectory(strDirPath)
End If

' Save the uploaded file in the directory
File1.PostedFile.SaveAs(strDirPath + "\" + strFileName)
End If
Any suggestions would be appreciated.
Regards
Sobhan

Nov 19 '05 #2

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

Similar topics

2
by: GMK | last post by:
Dear all in my asp.net application i have a text file that is installed with my application on the server. this text file is filled with data through a web interface in my application. i need to...
8
by: shandra | last post by:
I have a file I need to delete or truncate. I tried using the KILL command in VB6. I tried using the file.delete command in VB.net. I tried manually deleting, renaming, and copying over the...
2
by: SiouxieQ | last post by:
Hi there, I'm using the code below to try to delete a name from a list of names in a file. Unfortunately it doesn't quite do what I want it to. Instead of looking for the name in the...
3
by: Kimera.Kimera | last post by:
I'm trying to write a program in VB.net 2003 that basically deletes all files, folders, sub-folders and sub-sub folders (etc). The program is simply for deleting the Windows/Temp folder contents,...
13
by: programming | last post by:
how do i delete from a text file 1 of the following lines: jon|scott adam|smith <--delete paul|clark say i would like to delete the middle line of this txt, in member.txt what php code or...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.