![]() |
How to delete file in JavaScript
I did this but it does not work
:
function DeleteFile(filename) |
Couldn't tell you about the code, but Javascript isn't really made for modifying file system content. It can be done, but it is probably considered malicous code these days. If the code is correct, consider looking into whether or not your browser is actually letting the code run.
|
I suggest looking toward a more advanced code, such as java, php, perl, c# or vb.net for those type of problems.
|
Don't worry about it any more, i recode it in ASP.net with C#
|
Shudder. What do you mean, a more 'advanced code'? JavaScript might be a little clunky but there is nothing advanced about deleting a file.
Booooze probably has the right answer if this JavaScript code is trying to run inside a browser. But if it was trying to delete a file at the server side, then it's not malicious and should have worked; runat="Server" in the SCRIPT tag would avoid having the code sent to the client, which should refuse to instantiate the FileSystemObject for security reasons. As for moving to ASP.NET just for this functionality - do you have any idea what you've added to the footprint of your server-side script for the sake of an easy file delete?! Ah well, I suppose you get other advantages that way too. Ho hum. (Trying not to rant...) |
| All times are GMT -5. The time now is 3:57 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC