用多了有问题,自己改吧。当前目录有可写权限!!!
<%@LANGUAGE="VBSCRIPT"%>
<%
if Request.Form("loadno")="yes" then '判斷是否表單提交
set myfileobject=server.createobject("scripting.filesystemobject")
' myfilepath=server.mappath("vod.asx") '設寫文件路徑與文件名
myfilepath=server.mappath("vod.asx")
set mytextfile=myfileobject.createtextfile(myfilepath)
'''''''''''''''''''''''''''''''''''''' 開始寫文件
a="<asx version = " & chr(34) & "3.0" & chr(34) & ">"
mytextfile.writeline(a)
mytextfile.writeline(" <title>浏览器</title>")
dim x
x=1
dim y
y=Request.Form("upcount")+1
do while x < y '循环寫播放文件
if Request.Form("file" & x)<>"" then
mytextfile.writeline("<entry>")
b="<ref href = " & chr(34) & Request.Form("file" & x) & chr(34) & "/>"
mytextfile.writeline(b)
mytextfile.writeline("</entry>")
end if
x=x+1 '循环寫播放文件結束
loop
mytextfile.writeline("</asx>")
'''''''''''''''''''''''''''''''''''''''''''''''''寫文件結束
mytextfile.close
'set myfileobject=nothing
msg="添加成功!"
end if
%>
<body bgcolor="#FFFFFF" text="#000000" background="../1_2.gif">
<script language="javascript">
function setid()
{
str='<br>';
if(!window.form1.upcount.value || window.form1.upcount.value < 1)
window.form1.upcount.value=1;
for(i=1;i<=window.form1.upcount.value;i++)
str+='文件'+i+':<input type="file" name="file'+i+'" style="width:400"><br><br>';
window.upid.innerHTML=str+'<br>';
}
</script>
<form name="form1" method="post" action="">
<table width="1%" border="1" align="center">
<tr>
<td width="91%">
<div align="center"><b>网页片头播放文件设置</b></div>
</td>
</tr>
<tr>
<td width="91%">
<input type="text" name="upcount" value="5" maxlength="3">
<input type="button" name="Button" onclick="setid();" value="设定文件数">
</td>
</tr>
<tr>
<td height="2" id="upid" width="91%" >1.
<input type="file" name="file1" value="">
</td>
</tr>
<tr>
<td width="91%">
<div align="center">
<input type="submit" name="Submit" value="--确定--">
<input type="hidden" name="loadno" value="yes">
<%=msg%> </div>
</td>
</tr>
</table>
</form>
<p> </p>
<script language="javascript">
setid();
</script>
/////////////////////////////////////////////////////////////////
input.asp输入音乐文件路径
<form action="create_file.asp" method="post">
mp3路径:<input type="text" name="file_src">
<input type="submit">
</form>
create_file.asp生成播放列表
<%
file_src=trim(request.form("file_src"))
if file_src="" or isempty(file_src) then
%>
请填写MP3文件路径
<%else
strTmp=replace(replace(replace(now,":","")," ",""),"-","")
set objFso=Server.CreateObject("Scripting.FileSystemObject")
set txtFso=objFso.CreateTextFile(server.mappath(strTmp&".m3u"),true)
txtFso.writeline file_src
set txtFso=nothing
set objFso=nothing
%>
生成的m3u文件为:<a href="<%=strTmp%>.m3u"><%=strTmp%>.m3u</a>
<%
end if
%>