我尝试通过文件删除插件上传文件,但无法在 UploadHandler.ashx 中获取文件
我需要做的是上传文件
<fieldset id="zone">
<legend>Drop a file inside…</legend>
<p>Or click here to <em>Browse</em>..</p>
</fieldset>
<script type="text/javascript">
// Tell FileDrop we can deal with iframe uploads using this URL:
var options = { iframe: { url: 'UploadHandler.ashx'} };
// Attach FileDrop to an area:
var zone = new FileDrop('zone',options);
// Do something when a user chooses or drops a file:
zone.on.send.push(function (files) {
alert(files.count.toString());
// if browser supports files[] will contain multiple items.
for (var i = 0; i < files.length; i++) {
files[i].SendTo('UploadHandler.ashx');
//var file = files[i];
}
});
</script>
和 UploadHandler.ashx
context.Response.ContentType = "text/plain";
HttpFileCollection httpfiles = context.Request.Files;
for (int i = 0; i < httpfiles.Count; i++)
{
HttpPostedFile file = httpfiles[i];
file.SaveAs(@"C:\"+ Path.GetFileName(file.FileName.ToString()));
}
context.Response.Write(httpfiles.Count.ToString());
如何通过 context.Request.Files 获取文件;