jQuery fileupload プラグインを使用しています。
アップローダをフォーム内に配置しました (これは理想的ではないかもしれません)。ファイルは、キューに追加されると自動的にアップロードされます。
これは、それを処理する部分です。
// This function is called when a file is added to the queue;
// either via the browse button, or via drag/drop:
add: function (e, data) {
var tpl = $('<li class="working"><input type="text" value="0" data-readOnly="1" /><p></p><i class="icon-remove"></i></li>');
// Append the file name and file size
tpl.find('p').text(data.files[0].name)
.append('<span>' + formatFileSize(data.files[0].size) + '</span>');
// Add the HTML to the UL element
$t.find('.auc-upload-list').append(tpl);
data.context = tpl;
// Initialize the knob plugin
tpl.find('input').knob({
width: 20,
height: 20
});
// Listen for clicks on the cancel icon
tpl.find('i').click(function(){
if(tpl.hasClass('working')){
jqXHR.abort();
}
tpl.fadeOut(function(){
tpl.remove();
});
});
// Automatically upload the file once it is added to the queue
var jqXHR = data.submit();
},
var jqXHR = data.submit();
投稿を開始します。
残念ながら、他のすべてのフォーム フィールドも同様に投稿されます。どうにかしてそれを防ぐことはできますか?fileupload プラグインが指定されたファイル入力フィールドのみを投稿するようにするには?
または、プラグインに投稿できるフィールドと投稿できないフィールドを教えてください。