㈠ 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()&"/")
%>