Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > file system object

Thread Tools

file system object

Posts: n/a

I am building an upload script that overwrites any file with the same name,
however the file could be a jpg, gif, bmp etc

Using 'fso.FileExists ' i can find if a file of the same name exists and
remove it. The file will be saved as strMemberId.strFileExt

There is a possibility that file xyz.jpg may be re-uploaded as xyz.gif thus
while the new image will be written to the folder the previous file will not
be removed.

I am trying to find the best way of finding the file name of a file without
the extension so I can delete any files that may exist with the same name
but a have different extension. Is there a way of calling a wildcard in asp?

eg ' fso.FileExists(Server.MapPath("../tempfolder/" & strMemberId &".*" ))
' - tried this & several other combinations but it does not work.

The only other way I can see of doing it is to pass the file name into a
string, strip the extension off it and then build an array to loop through
the possible extensions but I am sure there is a better way.

Any thoughts?

Thanks In advance


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
File System Object - not deleting file Lise ASP General 3 06-08-2006 03:14 PM
Object reference not set to an instance of an object. System.Web.UI.WebControls.ListItemCollection.SaveViewState() System.Web.UI.WebControls.ListControl.SaveViewState() Brano ASP .Net 3 11-08-2005 12:29 PM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
System.Security.SecurityException: Error de solicitud de permiso de tipo System.Net.WebPermission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. Luis Esteban Valencia ASP .Net 0 07-14-2005 01:43 PM
Why are sender and object used as in sender As System.Object, ByVal e As System.EventArgs? Showjumper ASP .Net 2 08-02-2003 10:53 PM