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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file uploading in asp.net 1.1 1

Status
Not open for further replies.

PureDevelopers

IS-IT--Management
Aug 25, 2006
18
US
I am creating an image upload page for my site, and I would like to create a folder for each user. I have the file upload posting to a static folder, but I can't seem to find an example of how to create the user folder on the fly. Any ideas?
 
Shouldn't be too hard. Find out what user is currently logged in, if a folder exists then post the file to it, if not then create the new folder and then post the file. The syntax will vary based on the version of the framework that you are using. It is easiest to post to a folder in the virtual directory. also when you push out new updates make sure not to overwrite those folders.

What version of the framework are you using.
 
Thanks for the input, but what is the command to create a folder? Folder.Create(path) or something like that, and how what is the command to determine if the folder already exists?
I want something like:
path = "UserPics" & intUserID
if not folder.Exists(path) Then
CreateFolder(path)
End If
 
Try looking at the System.IO.File and System.IO.Directory classes. You'll find all you need to do this in both of those.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Perfect, thanks thats exactly what I was looking for.

If Directory.Exists(path) = False Then
' Create the directory.
Directory.CreateDirectory(path)
End If

If Directory.Exists(target) Then
' Delete the target to ensure it is not there.
Directory.Delete(target, True)
End If

I just thought I would post a solution to the problem.
 
Thanks for posting your solution


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top