General discussion

Locked

Server/Client side script file delete?

By 3wadman ·
I need a VBscript or Jscript that can be called from a <Body onLoad> that will delete a file that was created during the page load using VBscript.

The ASP page creates a temporary file using the Scripting.FileSystemObject, which the page loads into a Iframe. I can't find a way to delete the temporary file after the page has finished loading. (Client side can't talk to Server side.)

Click on any store on the www.triplewmall.com site to see how the enterstore.asp page works

This conversation is currently closed to new comments.

6 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Server/Client side script file delete?

by Bojidar Alexandrov In reply to Server/Client side script ...

You cant do this in this way. Check also this case - page is loaded, eventualy file is deleted and after that user wants to refresh contents of the iframe.
Better approach is to delete temporary files on regular basis - a server side script can be run every hour and delete all files older than 1 hour.

Collapse -

Server/Client side script file delete?

by 3wadman In reply to Server/Client side script ...

Their must be a way to invoke a server side script based on a page event. I like to take care of all business within each static page. If I had to delete the files, via a maintance page, it must be based on traffic. I think opening a ASP page as an object is the key.

Collapse -

Server/Client side script file delete?

by 3wadman In reply to Server/Client side script ...

(Here's a thought) IF I can pass the temporary file name to another iFrame located at the bottom of the page, that iFrame could call a ASP page that will delete the file. The top iFrame should load first. (I'll try it)

Collapse -

Server/Client side script file delete?

by Jay Eckles In reply to Server/Client side script ...

There are a couple of tricks you could use. My favorite is

<script language="Javascript" type="text/javascript" src="http://yourserver.com/deletefile.asp?filename=name"></script>

You'd probably want to put this as the last thing before </body>. deletefile.asp should delete the file, then return
Content-type: text/javascript
Content-length: 0

Obviously your first ASP could populate the value of "filename". That would accomodate multiple unique filenames that need to be deleted.
Good luck.

Jay
www.jayeckles.com

Collapse -

Server/Client side script file delete?

by 3wadman In reply to Server/Client side script ...

That's what I came up with as a solution, except I just added another iFrame at the bottom. Nobody got the points but I have another problem I'll post next. Check it out! Thanks.

Collapse -

Server/Client side script file delete?

by 3wadman In reply to Server/Client side script ...

This question was closed by the author

Back to Web Development Forum
6 total posts (Page 1 of 1)  

Related Discussions

Related Forums