嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元微信扫码支付:2 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
Uploadify文件上传
<script type="text/javascript">
$(document).ready(function () {
$("#uploadify").uploadify({
height: 30,
swf: '/js/uploadify.swf',
uploader: '/upload.ashx?GID=10086',
width: 120,
buttonText: '选择文件上传',
cancelImg: '/js/uploadify-cancel.png',
folder: 'Upload',
queueID: 'fileQueue',
auto: true,
multi: true,
onUploadSuccess: function (fileObj, data, response) {
$("#AttachmentList").append("</br><a href='" response "' target='_blank'>" fileObj.name "</a>");
}
});
});
</script>
public void ProcessRequest(HttpContext context)
{
var Response = context.Response;
var Request = context.Request;
var Session = context.Session;
string s_rpath = @"D:\Projects\MyNETProjects\trunk\UploadifyDemo\UploadifyDemo\Upload\";
string Datedir = DateTime.Now.ToString("yy-MM-dd");
string updir = s_rpath "\\" Datedir;
Response.CacheControl = "no-cache";
if (Request.Files.Count > 0)
{
try
{
for (var j = 0; j < Request.Files.Count; j )
{
var uploadFile = Request.Files[j];
if (uploadFile.ContentLength <= 0) continue;
if (!Directory.Exists(updir))
{
Directory.CreateDirectory(updir);
}
var extname = Path.GetExtension(uploadFile.FileName);
var fullname = DateTime.Now.Year.ToString() DateTime.Now.Month.ToString()
DateTime.Now.Day.ToString() DateTime.Now.Hour.ToString()
DateTime.Now.Minute.ToString() DateTime.Now.Second.ToString();
var filename = uploadFile.FileName;
uploadFile.SaveAs(string.Format("{0}\\{1}", updir, filename));
}
}
catch (Exception ex)
{
Response.Write("Message" ex.ToString());
}
}
}