我正在开发一个新的拖放文件插件,但是,与所有那些插件不同,我不希望它在“丢弃”时上传它。
这个想法是: 1.用户拖放文件。
2.(一些魔法)
3.用户提交表单并且只有那些文件上传到服务器
我尝试将文件名作为 追加到表单中input type=hidden
,但是我无法在服务器端(php)对它做任何事情;
我可以将文件的详细信息附加到一个input type=file
字段中,以便浏览器“认为”该文件已通过常规选择file input field
我的js:
$('#drop-zone').bind('drop', function(e) {
// This variable represents the files that have been dragged
// into the drop area
var files = e.dataTransfer.files;
$('#uploaded-list').show();
// For each file
$.each(files, function(index, file) {
/* What can I do in here?*/
});
});
谢谢。