この質問を理解できることを願っています。
私は現在、jQuery Form Plugin+Validationを使用しています。
しかし、私が達成しようとしているのは、
1、次のステップで操作するための一時ファイルをアップロードします
2、ファイルがアップロードされたら、通常どおりフォームを送信して次のステップ(新しいファイル)に進みます。
だから私はそれを達成する方法を100%確信しています、私は現在このコードを使用しています。
$("#fileUpload").validate({
submitHandler: function(form) {
$(form).ajaxSubmit({
beforeSubmit: function() {
$('input').attr("disabled", true);
$("#uploadResponse").show('slow');
$('#uploadResponse').append("<img src='images/icons/ajax-loader.gif' />");
},
success: function(responseText, statusText, xhr, form) {
$('input[type=submit]').attr("disabled", false);
$('input[type=file]').attr("disabled", true);
},
error: function (responseText, statusText, xhr, form) {
alert("Oops... Looks like there has been a problem.");
}
});
}
});
そして私のフォームのために
<div id="uploadResponse" style="display: none;"> File Uploading, this can take a few minutes... </div>
<form action='page.ImportContacts2.php' name="mergeCSV" id="fileUpload" method="post" enctype="multipart/form-data" >
File: <input id="getCSV" name="getCSV" class="required" type="file">
Delimiter Type:
<select id="delimiter" name="delimiter">
<option value="1" selected="selected">Comma</option>
<option value="2">Tab</option>
</select>
Enclosure Type:
<select id="enclosure" name="enclosure">
<option value="1" selected="selected">Double Quotes (")</option>
<option value="2">Single Quotes (\')</option>
</select>
<button type="submit" name="SubmitCSV" id="SubmitCSV" value="SubmitCSV" class="csvCol3Button buttonSmall">Upload File</button>
</form>