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

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

new
Spirituality
Home Improvement
Vegetarian
NASCAR
Southcentral USA


dailyclick
All times in EST

Full Schedule
g
g ASP Site
Editor Wanted
BellaOnline's ASP Editor

g

DeleteFile - Deleting a File
Guest Author - Lisa Shea

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.

This site needs an editor - click to learn more!

RSS | Related Articles | Previous Features | Site Map


Content copyright © 2008 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 BellaOnline Administration for details.

Digg! g delicious Save to Del.icio.us

g


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

g features
Best uses for RSS

RSS and its future.

Force Download Dialog box with ASP

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Driving Amount
Much more
Slightly more
Slightly less
Much less

g


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


BellaOnline Editor