|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Problem with fso movefile (file already exists)
Guys
I'm posting files using a multipart form and ms posting acceptor to a folder on our intranet server. No problem. I then attach them to an email using CDONTS and off they go. Now, I was then deleting them from the folder using fso deletefile and all was fine but I decided that rather than delete them, I would move them to another folder. I create the subfolder thus: Code:
'create a folder especially for this requisition...
Dim filesys, demofolder, folcoll
Set filesys = CreateObject("Scripting.FileSystemObject")
Set demofolder = filesys.GetFolder("D:\intranet\uploads\")
Set folcoll = demofolder.SubFolders
folcoll.Add(rs.Fields("requisitionID").Value)
...fine, but then when I try to move the files: Code:
'...and move the attachments into it....
dim objfilesys
for intx = lbound(arrX) to ubound(arrX)
Set objfilesys = CreateObject("Scripting.FileSystemObject")
objfilesys.MoveFile Server.MapPath("../uploads/" & arrX(intx)), Server.MapPath("../uploads/" & rs.Fields("requisitionID").Value & "/")
Next
it all goes pear shaped and I get the error: Microsoft VBScript runtime error '800a003a' File already exists Any help would be greatly appreciated as I'm just about fed up of all this web development lark and am contemplating becoming a zoo keeper instead. Or something. Cheers |
|
#2
|
||||
|
||||
|
Resolved
Changing this:
objfilesys.MoveFile Server.MapPath("../uploads/" & arrX(intx)), Server.MapPath("../uploads/" & rs.Fields("requisitionID").Value & "/") to this: objfilesys.MoveFile Server.MapPath("../uploads/" & arrX(intx)), "D:\intranet\uploads\" & rs.Fields("requisitionID").Value & "/" Did the trick. Hope this is useful to someone else. Cheers |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Problem with fso movefile (file already exists) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|