jQuery MiniUI 开发教程 表单控件 FileUpload:文件上传控件(二十)

FileUpload:文件上传控件

参考示例:FileUpload:文件上传控件

创建FileUpload

<inputid="fileupload1"class="mini-fileupload"name="Fdata"limitType="*.txt"

flashUrl="swfupload/swfupload.swf"

uploadUrl="upload.aspx"

onuploadsuccess="onUploadSuccess"/>

服务端处理

//获得程序路径

stringtempFile=Request.PhysicalApplicationPath;

//找到目标文件对象

HttpPostedFileuploadFile=Request.Files["Fdata"];

//如果有文件,则保存到一个地址

if(uploadFile.ContentLength>0)

{

uploadFile.SaveAs(string.Format("{0}{1}{2}",tempFile,"demo\\fileUpload\\upload\\",uploadFile.FileName));

}

Response.Write(uploadFile.FileName+"("+DateTime.Now+")");//可以返回一个JSON字符串,在客户端做更多处理

相关推荐