I’m trying to use FSO = Server.CreateObject(“Scripting.FileSystemObject”) to copy/save files utilising a ASP utility called ‘csImageFile’
At present the FSO code I have is on a separate .asp page. This is called from a page when the user selects an option (using value=”xxx.asp…” to call code page). This works fine.
The problems is that the FSO code page response.redirects to the calling page and the refresh loses data.
I’d like the ‘onlclick’ of the select/option to call the FSO code by placing the code in a subrouting on the original calling page (hence avoiding the refresh). I’ve tried this by various ways without success. I presently call a js function which itself then calls a VBscript subroutine. This is may not be correct but I’ve tried so many permutations I’m a bit lost now.
on page
<option onclick="calljsSub()"...
the scripts
<script language="JavaScript">
function calljsSub(){
//alert("js called");
VBFunc();
}
</script>
<script language="VBScript">
Sub VBFunc()
SET FSO = Server.CreateObject("Scripting.FileSystemObject")
If FSO.FileExists ( "path to file") Then
Set Image = Server.CreateObject("csImageFile.Manage")
Image.ReadFile "path to file"
Image.WriteFile Server.MapPath("path to new file")
end if
Set FSO = Nothing
End Sub
The VBScript function appears to do nothing. Perhaps there is another way of runnning the code without refreshing?? Any advice is welcome.
I’d be very grateful for any advice as I’ve been trying to solve this since before Christmas.
Mark thanks
Mark
Thanks for anyone trying to help. I’ve sort this out by calling the asp page through a hidden iframe on the main page. Cheers.