logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
Action Movies
Bible Basics
Houseplants
Romance Movies
Creativity
Family Travel
Southwest USA


dailyclick
All times in EST

Full Schedule
g
g ASP Site

BellaOnline's ASP Editor

g

DeleteFile - Deleting a File


You should be very cautious in using this function, because it allows an ASP script to permanently delete a file from your server's hard drive.

As you might imagine, there are actually many important applications for this. If you let clients load up ads onto your server, and then delete a client from your system, you can use DeleteFile to remove all those ad graphics. If you create online postcards, DeleteFile can let you sweep out the old ones each month.

Really, only two lines are necessary for this function:

Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
ScriptObject.DeleteFile(filename)

You do of course have to set the "filename" variable to be a valid filename! :) You can either hard code this to be a certain file if you know what file will be deleted, you can take it as input from a form, or you can loop through a sequence of known values (if for example you named your postcards post1.html, post2.html, post3.html, etc).

Be VERY cautious that you never just let this function take in any file name at all. Hackers could then easily send in important file names and destroy your website.
Add DeleteFile+%2D+Deleting+a+File to Twitter Add DeleteFile+%2D+Deleting+a+File to Facebook Add DeleteFile+%2D+Deleting+a+File to MySpace Add DeleteFile+%2D+Deleting+a+File to Del.icio.us Digg DeleteFile+%2D+Deleting+a+File Add DeleteFile+%2D+Deleting+a+File to Yahoo My Web Add DeleteFile+%2D+Deleting+a+File to Google Bookmarks Add DeleteFile+%2D+Deleting+a+File to Stumbleupon Add DeleteFile+%2D+Deleting+a+File to Reddit




RSS | Related Articles | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


For FREE email updates, subscribe to the ASP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2014 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact Lisa Shea for details.

g


g features
Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2014 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor