㈠ IIS無法供ASP使用FSO創建文件夾.無許可權
建議你查看一下IIS中網站或
虛擬目錄
的屬性中的主目錄或虛擬目錄
選項卡
中的"寫入"項是否勾上.
㈡ 修改用ASP創建文件夾的代碼
fs.CreateFolder "C:\Inetpub\wwwroot\fifstudy\guangtou"
就可以了,該函數只有一個必要參數
㈢ 關於asp+fso創建文件夾,復制文件的問題
你提供的代碼好復雜,所以沒有細看,大概是因為路徑的關系而出錯。以下這個測試無誤,需要注意要創建的文件夾及moban文件夾在當前文件的上一目錄!
<%
userdir=username
dir=server.MapPath("../"&userdir) '根據你後面的文件地址,確定應該是上一級
set fso = server.CreateObject("Scripting.FileSystemObject")
if not fso.FolderExists(dir) then '如果文件夾不存在則創建
fso.CreateFolder(dir)
end if
file1=server.MapPath("../moban/index.asp")&","&server.MapPath("../moban/list.asp")&","&server.MapPath("../moban/conn.asp")
tofile1=server.MapPath("../"&userdir&"/index.asp")&","&server.MapPath("../"&userdir&"/list.asp")&","&server.MapPath("../"&userdir&"/conn.asp")
'少寫點代碼 所以放到數組中
filex=split(file1,",")
filey=split(tofile1,",")
for i=0 to ubound(filex) '循環復制文件
call fso.file(filex(i),filey(i))
next
set fso = nothing
%>
㈣ ASP新建文件夾問題。
asp 創建文件與文件夾代碼參考如下:
'==============================
'函 數 名:CreateFolder
'作 用:創建文件夾
'參 數:文件夾相對路徑FolderPath
'==============================
Function CreateFolder(FolderPath)
' On Error Resume Next
Set Fso=Server.CreateObject("Scri"&"pting.File"&"Sys"&"temObject")
Set F=Fso.CreateFolder(Server.MapPath(FolderPath))
CreateFolder=F.Path
Set F=Nothing
Set Fso=Nothing
' Select Case Err
' Case 424 Response.Write("方卡錯誤提示:創建"&FolderPath&"文件夾時,路徑未找到或者該目錄沒有寫入許可權!")
' End Select
End Function
'==============================
'函 數 名:CreateFile
'作 用:創建文件
'參 數:文件相對路徑FilePath,文件內容FileContent
'==============================
Function CreateFile(FilePath,FileContent)
' On Error Resume Next
Dim Temps
Temps=""
TempArr=Split(FilePath,"/")
For i=0 to UBound(TempArr)-1
If Temps="" Then
Temps=TempArr(i)
Else
Temps=Temps&"/"&TempArr(i)
End If
If IsFolder(Temps)=False Then
Call CreateFolder(Temps)
End If
Next
Set objAdoStream = Server.CreateObject("A"&"dod"&"b.St"&"r"&"eam")
objAdoStream.Type = 2
objAdoStream.Charset = "UTF-8"
objAdoStream.Open
objAdoStream.WriteText = FileContent
objAdoStream.SaveToFile Server.MapPath(FilePath),2
objAdoStream.Close()
Set objAdoStream = Nothing
' Select Case Err
' Case 424 Response.Write("方卡錯誤提示:創建"&FilePath&"文件時,路徑未找到或者該目錄沒有寫入許可權!")
' End Select
End Function
㈤ ASP自動創建文件夾並在該文件夾下生成html文件
<%
fname="你的文件襲路徑"
pencat="你的文件內容"
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.CreateTextFile(server.mappath(fname))
fout.WriteLine pencat
fout.close
response.write("文件已成功生成!")
%>
<a href=<%=fname%>>點擊查看</a>
fname="你的文件路徑"
在這里如果你給定的路徑是 job/index.html,那麼就會生成job為名稱的文件夾,而後在其中生成文件index.html。
㈥ 許可權全開,ASP無法創建文件夾,可以創建文件,請高和解答
A伺服器上的ASP程序不能在B伺服器上創建文件夾。
只能把ASP程序放在內B伺服器上,然後在A伺服器上訪問這個程容序創建文件夾。
創建文件夾的程序可以這么寫:
<%
Dim Fso,Path
Path = Server.Mappath("Test") '雙引號內的Test就是要創建的文件夾
Set Fso = Server.CreateObject("Scripting.FileSystemObject")
If Not Fso.FolderExists(Path) Then Fso.CreateFolder(Path)
Set Fso = Nothing
%>
㈦ asp創建文件夾
下面是表單代碼:
<form id="form1" name="form1" method="post" action="folder.asp">
請指定<span class="STYLE3">文件位置和文件名: <input type="text" name="createflie">
<input type="submit" name="Submit" value="確定" />
</form>
提交到folder.asp
<%
folder = request("createflie")
set fso = server.CreateObject("scripting.filesystemobject")
fso.createfolder(server.MapPath(".\"&folder&""))
response.Write("文件夾創專建成功")
%>
經測試可以創屬建成功
㈧ asp下創建文件夾問題
formPath="/upload/day_"&DateFormat(now,"yymmdd")
CreateFolder(formPath)版
Function CreateFolder(FolderPath)
權dim lpath,fs,f
lpath=Server.MapPath(FolderPath)
Set fs=Server.CreateObject("Scri"&"pting.File"&"Sys"&"temObject")
If not fs.FolderExists(lpath) then
Set f=fs.CreateFolder(lpath)
CreateFolder=F.Path
end if
Set F=Nothing
Set fs=Nothing
End Function
㈨ asp在伺服器端如何創建文件夾
用FSO創建,判斷是否存在,然後創建。
也可以直接創建,如果生成失敗專就證明有了。屬
tmppath="D:\2012\01\25\13\25\36"
if not objfolder.folderexists(tmppath) then objfolder.createfolder tmppath
㈩ asp fso創建文件夾(郁悶)
<%
function CheckFolder(path)
Set fs = Server.CreateObject("Scripting.FileSystemObject")
If fs.FolderExists(Server.MapPath(path)) = true Then
return true
Else
return false
End If
end function
function CreateFolder(path)
If CheckFolder(path) = false Then
fso.CreateFolder(Server.MapPath(path))
End If
end function
folder = date()&"/"
CreateFolder("/News/")
CreateFolder("News/"&date()&"/")
%>