前端代码:
<%@ Register Assembly=”CuteEditor” Namespace=”CuteEditor” TagPrefix=”CE” %>
<CE:UploadSingleFile runat=”server” ID=”UploadSingleFileMusic”
onfileuploaded=”UploadSingleFileMusic_FileUploaded” InsertText=”请选择一个音频文件”
ItemTextTemplate=”{0} {1} ({2}) {3}”
ProgressTextTemplate=”%F%..%P% %SEND%/%SIZE%,%KBPS%,%T% seconds remain.”
CancelText=”取消上传”>
<ProgressPanelStyle Direction=”NotSet” HorizontalAlign=”NotSet” ScrollBars=”None” Wrap=”True”></ProgressPanelStyle>
<ValidateOption Extensions=”wav,mp3,rm,data,swf,flv” />
</CE:UploadSingleFile>
CodeBehind代码:
protected void UploadSingleFileMusic_FileUploaded(object sender, CuteEditor.UploaderEventArgs args)
{
string s = Server.MapPath(“upload”);
args.CopyTo(s+”\\”+”newname”);
}
说明:
1.该控件上传时先放入临时文件夹,调试时是放到了计算机用户下的temp文件夹,因该文件夹权限原因moveto失败,未测试iis下该控件设置的Temp是否生效。
2. 上传文件的其他属性请查看args获取,如args.GetTempFilePath()等
3. 用CopyTo时可在newname后再加上文件后缀
关于作者