1
我希望我能理解這個問題。jQuery上傳一個文件,然後通常提交表格
我目前正在使用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>
嘿,目前我使用這個表單提交: – Justin 2010-12-02 01:30:22