![]() |
|
|
#1 (permalink) |
|
Registered User
Join Date: Oct 2004
Posts: 31
|
Creating folders dynamically
Dim MyPath, MyName As String
MyPath = Request.PhysicalApplicationPath & "images\user\" & Format(Now, "dd_MM_yy") ' Set the path. MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry. Try If MyName = "" Then ' The folder is not there & to be created Dim objDir As New DirectoryInfo(Request.PhysicalApplicationPath & "images\user\" & Format(Now, "dd_MM_yy")) objDir.Create() End If i am getting an error:- Could not find a part of the path "d:\". Is there a special way to create folders within the website? the code above works fine on my own machine |
|
|
|
|
|
#6 (permalink) |
|
Registered User
Join Date: Oct 2004
Posts: 31
|
just did
just tried it there no luck it would seem
still same error changed the paths to be hardcoded here's the code Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here 'todo 'Needed on every page intUserID = CInt(Session("UserID")) If intUserID = 0 Then 'user has no session Response.Redirect("../UserLogin/Login.aspx", True) End If If Not Me.IsPostBack Then ''FIRST WE NEED TO CHECK THAT THE FOLDER FOR TODAYS PHOTOS HAS BEEN CREATED Dim MyPath, MyName As String MyPath = "d:\domains\datewithadifference.com\wwwroot\images \user\" & Format(Now, "dd_MM_yy") ' Set the path. MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry. Try If MyName = "" Then ' The folder is not there & to be created 'Folder created Dim objDir As New DirectoryInfo("d:\domains\datewithadifference.com\ wwwroot\images\user\images\user\" & Format(Now, "dd_MM_yy")) objDir.Create() End If |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|