A
Arpan
A Form has a FileUpload, 2 Buttons & a TextBox web server controls.
Using the FileUpload control, I want to give users the provision to
move & delete files that DO NOT exist in C:\Inetpub\wwwroot (i.e. the
root directory). This is the code:
<script runat="server">
Sub MoveFile(ByVal obj As Object, ByVal ea As EventArgs)
File.Move(fudFileSource.FileName, txtFileDest.Text)
'File.Move("F:\4.jpg", "C:\4.jpg")
End Sub
Sub DeleteFile(ByVal obj As Object, ByVal ea As EventArgs)
File.Delete(fudFileSource.FileName)
'File.Delete("F:\4.jpg")
End Sub
</script>
Now since the files do not exist in the root directory, I can't use
Server.MapPath but if I simply use fudFIleSource.FileName &
txtFileDest.Text to move a file from location to another location, then
the following error gets generated pointing to the File.Move() line:
Could not find file 'C:\WINNT\system32\4.jpg'.
& in case of the Delete method, the file doesn't get deleted. Is there
any way by which I can let users move & delete files that DO NOT exist
in the root directory?
Note that if I use the physical path of the files (as shown in the 2
commented lines in the code above), then both the Move & Delete methods
get executed successfully.
Thanks,
Arpan
Using the FileUpload control, I want to give users the provision to
move & delete files that DO NOT exist in C:\Inetpub\wwwroot (i.e. the
root directory). This is the code:
<script runat="server">
Sub MoveFile(ByVal obj As Object, ByVal ea As EventArgs)
File.Move(fudFileSource.FileName, txtFileDest.Text)
'File.Move("F:\4.jpg", "C:\4.jpg")
End Sub
Sub DeleteFile(ByVal obj As Object, ByVal ea As EventArgs)
File.Delete(fudFileSource.FileName)
'File.Delete("F:\4.jpg")
End Sub
</script>
Now since the files do not exist in the root directory, I can't use
Server.MapPath but if I simply use fudFIleSource.FileName &
txtFileDest.Text to move a file from location to another location, then
the following error gets generated pointing to the File.Move() line:
Could not find file 'C:\WINNT\system32\4.jpg'.
& in case of the Delete method, the file doesn't get deleted. Is there
any way by which I can let users move & delete files that DO NOT exist
in the root directory?
Note that if I use the physical path of the files (as shown in the 2
commented lines in the code above), then both the Move & Delete methods
get executed successfully.
Thanks,
Arpan