473,903 Members | 5,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

nightangel
1 New Member
Hi dude,what i was done in my application is uploading a image file to my server using FTP, it work great when pushing a file into the server path using FTP.
The problem i met now is i need to do a resuming for the file uploading if the client connection or server connection is down.

E.g: Sunset.jpg (500KB) when i upload until half of it, (332KB in the server) and unplug my connection, it will looping and try to connect to the server, after i plug back, the FTP login is success, but it throw me an exception, say that: Sunset.jpg "The process cannot access the file because it is being used by another process".

How can i solve the problem? how do i close the file opening in the server?

Expand|Select|Wrap|Line Numbers
  1. SendCommand("STOR " & Path.GetFileName(sFileName))
  2.  
  3. ' Send a command to the FTP Server.
  4. Private Sub SendCommand(ByVal sCommand As String)
  5.         sCommand = sCommand & ControlChars.CrLf
  6.         Dim cmdbytes As Byte() = ASCII.GetBytes(sCommand)
  7.  
  8.         m_objClientSocket.Send(cmdbytes, cmdbytes.Length, 0)
  9.  
  10.         ReadReply()
  11. End Sub
  12.  
  13.  ' Read the reply from the FTP Server
  14. Private Sub ReadReply()
  15.         m_sMes = ""
  16.         m_sReply = ReadLine()
  17.         m_iRetValue = Int32.Parse(m_sReply.Substring(0, 3))
  18. End Sub
  19.  
  20. ' Read a line from the server.
  21. Private Function ReadLine() As String
  22.  
  23.         Dim seperator As Char = ControlChars.Lf
  24.         Dim mess() As String
  25.  
  26.         If (bClearMes) Then
  27.             m_sMes = ""
  28.         End If
  29.         Do While (True)
  30.             Array.Clear(m_aBuffer, 0, BLOCK_SIZE)
  31.             m_iBytes = m_objClientSocket.Receive(m_aBuffer, m_aBuffer.Length, 0)
  32.             m_sMes += ASCII.GetString(m_aBuffer, 0, m_iBytes)
  33.  
When the program is reading the line from the server, it replying a message from " m_sMes " : Sunset.jpg "The process cannot access the file because it is being used by another process".
Apr 20 '07 #1
0 2969

Sign in to post your reply or Sign up for a free account.

Similar topics

9
715
by: Paul | last post by:
Hi, VB.NET is saying the file I am creating is in use by another process and won't complete its task of moving the file to the specified destination folder. Here is my code (the main bit anyway).... Private Sub LogChange(ByVal source As Object, ByVal e As System.IO.FileSystemEventArgs) If e.ChangeType = WatcherChangeTypes.Created Then
4
8335
by: Mountain Bikn' Guy | last post by:
I am having serious problems with the following IDE bug: Could not write to output file 'x.dll' -- 'The process cannot access the file because it is being used by another process. ' and BUG: "Could Not Copy Temporary Files to the Output Directory" Error Message When You Build a Solution That Contains Multiple Projects I have tried all the solutions in Microsoft Knowledge Base Article - 313512.
2
7779
by: Raed Sawalha | last post by:
Hello , I have windows service which do listening to specified directory using FileSystemWatcher , on Created Event and Get all the files in the directory using Directory.GetFiles function then foreach file in the files list and passed the file path to a function to read its content then process it then move it to another directory am reading each file content using StreamReader...ReadToEnd function, all process working fine , That when 50...
4
8847
by: Jerry | last post by:
I've inherited a system w/5 projects - I'll refer to them as P1 thru P5 - P5 being the executable... P1 has no dependents. P2 is dependant upon P1 P3 has no dependents. P4 is dependant upon P1, P2, P3 P5 is dependant upon P1, P2, P3, P4 The build order is: P1, P2, P3, P4, P5
3
3809
by: guoqi zheng | last post by:
Dear sir, There is an import tool on my web application, user can upload Ms Access file, the file is saved at a temp folder on the server. After the import is finished, for security reason, I need to delete the imported Ms Access file, however, I always get above error, "The process cannot access the file because it is being used by another process" I did close the datareader and connection object. What else can I do to delete this...
2
7108
by: Piyush | last post by:
Hi, I am getting the error "The process cannot access the file "C:\Documents and Settings\piyush\Desktop\200309181051.ktl" because it is being used by another process." when I try to open this file using fileopen in VB.Net I am very sure that the file is not being used by any other process as I tried to open other files without success.Also I rebooted my machine & again tried to open the file.but its giving me same error. Does anybody...
0
1647
by: chris | last post by:
In VB6.0 I was using API calls for checking that a process has finished and then continue with other steps: var_process_number = Shell("wzunzip.exe -o " & """" & fld_ZIP_file_name & """" & " " & """" & fld_import_path & """", vbMinimizedNoFocus) 'wait until the uncompressing is over var_process_handle = OpenProcess(&H100000, True, var_process_number)
0
1814
by: imranabdulaziz | last post by:
Dear All, I am making web application using Asp.net C#(Visual Studio2005). And Sql server 2005 as a back End I generated local mode report but as there was no printing option available . I assign printing feature to button click by exporting the data to EMF format and print Now when I run it through IDE VS2005 then it does not show any error. But when I run in through IIS in intranet it showing me this error The process cannot access...
3
3347
by: gracepaul | last post by:
hi, i got an exception while i m trying to zip/unzip a database inside the serverfolder System.IO.IOException: The process cannot access the file 'E:\hshome\holsoftsystems\indusmotor.co.in\MTNMRN1\MTNMRN1\MTNMRN2\Hrm123.ldb' because it is being used by another process. the database is being used by another process. i have to zip this database and download it provided it can be used by another process. how can i do this i use the...
0
9849
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11285
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10878
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10986
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10501
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9688
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6094
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4727
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 we have to send another system
3
3324
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.