Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check if Folder exists

Status
Not open for further replies.

JohannIcon

Programmer
Sep 3, 2002
440
MT
Hi all,

I am trying to upload an image on the server, however if the folder does not exist, it is giving me an error obviusly that the folder does not exist. How can I check if it does?

At the moment I am inserting the image as follows:-

var upLoad = Server.CreateObject( 'w3.upload' );
chosenName = String ( upLoad.Form( 'fileName2' ).item );
file = upLoad.Form( 'theFile' );
if ( file.IsFile )
{
file.SavetoFile(Server.MapPath("\\images\\councillors\\"+chosenName));
%>
The file has been saved as <%= chosenName %>.<BR>
<%
}
%>

Thanks for your help
 
Hi....try this...

Code:
Dim strFolder, objFSO

strFolder = &quot;C:\Temp\MyFolderName&quot;

Set objFSO = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)

If objFSO.FolderExists(strFolder) Then
...some code here
Else
..some other code here
End If

Set objFSO = Nothing
Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top