我上传的是avi各式的。但只有我的机子能放,其他人的只有声音。请各位大虾帮忙!本人不胜感激!代码如下:<tr>
<td colspan="3" height="200">
<p align="center">
<embed type="application/x-mplayer2" src="<%=MediaSrc%>" autostart="true" loop="false" height=194 width=205 showstatusbar="1" />
</p></td>
</tr>
数据库:<%@ LANGUAGE = VBScript CodePage = 936%>
<style type="text/css">
body {
font-size:12px;
}
</style>
<%
'Option Explicit
Response.Buffer = True
If Not Response.IsClientConnected Then
Response.End()
End If
Response.Charset = "GB2312"
%>
<!--#include file="upload_5xsoft.inc"-->
<%
Dim FileMaxSize
FileMaxSize = 1048576 * 20
If Request.QueryString("act")="add" Then
Server.ScriptTimeout=999
Dim path,Upload,file1,msg
path="/trade/media"
Set Upload=new upload_5xSoft '建立上传对象
Dim mSrc
Set file1 = Upload.File("file")
'On Error Resume Next
if file1.FileSize>0 and file1.FileSize<FileMaxSize then
dim fileName, filetype
fileName = file1.filename
filetype=Right(fileName,4)
'Strcomp(str1,str2,i) i=1时不区分大小写,
If StrComp(filetype,".wmv",1)=0 or StrComp(filetype,".avi",1)=0 or StrComp(filetype,".mpg",1)=0 or StrComp(filetype,".mp3",1)=0 Then
Dim num
Randomize
num = int(rnd * 99)
fileName = Cstr( right(year(now),2) & month(now) & day(now) & hour(now) & minute(now) & Cstr(num) ) & filetype
mSrc = path & "/" & fileName
file1.SaveAs Server.Mappath(mSrc) '保存文件
Response.Write("<script>parent.document.form1.URL.value=""" & mSrc & """;</script>")
msg="上传成功!"
color="green"
else
msg="上传文件的格式不对"
color="red"
end if
else
msg="文件大小超出限额"
color="red"
end if
response.Write("<font color=" & color & ">" & msg & "</font> <a href='uploadMedia.asp'>继续上传</a>")
Response.End()
Else
%>
<script>
function formcheck() {
if(document.getElementById("file").value == "") {
alert("请选择上传文件");
document.getElementById("file").focus();
return false;
}
form_upload.Submitbtn.value = "上传中,请稍后...";
return true;
}
</script>
<form action="uploadMedia.asp?act=add" method="post" enctype="multipart/form-data" id="form_upload" name="form_upload" onsubmit="return formcheck()">
<input name="file" type="file" id="file" size="15" />
<input type="submit" name="Submitbtn" value="上传" />
文件大小<<font color="#FF0000">20M</font> 文件类型:wmv,avi,mpg
</form>
<%End If%>