I have a file move issue that only started because I had to take a sub-folder on my site, and [convert to Application
Here is a portion of the code I am using.
For Each postedFile As HttpPostedFile In filMyFile.PostedFiles
Dim getfile As String = System.IO.Path.GetFileName(postedFile.FileName)
Dim FileToMove As String
Dim MoveLocation As String
GlobalVariables.savepath = Context.Server.MapPath("../Media/Temp/")
GlobalVariables.MovePath = Context.Server.MapPath("../Media/")
FileToMove = (GlobalVariables.savepath & getfile & ".mp3")
MoveLocation = (GlobalVariables.MovePath & strPath & "/" & getfile & ".mp3")
If System.IO.File.Exists(FileToMove) = True Then
My.Computer.FileSystem.MoveFile(FileToMove, MoveLocation) ' <<<< ERROR POINTS HERE
The code was working correctly until I changed the sub-folder to [convert to Application
Once I did that, I received this error.
Permissions are correctly given for the folder, so it does not seem to be a permissions issue.
I used Windows Resource Monitor.
Chose the CPU tab.
Searched for mp3 in the [Associated Handles]
Here is one line from the results of the search
Image PID Type Handle Name
w3wp.exe 12272 File G:\InetPub\wwwroot\mysite\Media\Temp\03112020223702438.mp3
I read that I needed to close the opened file.
I tried to do.
mp3.Dispose() ' did nothing
filMyFile.Dispose() ' did nothing
Any other suggestions to help get past this issue, so it will go back to working correctly?