【发布时间】:2012-02-25 20:15:48
【问题描述】:
我有一个表格,像这样
<form id="picuploadform" enctype="multipart/form-data" method="post" action="">
<div class="row">
<label for="fileToUpload">Select a File to Upload</label><br />
<input type="file" name="fileToUpload" id="fileToUpload" />
<input type="hidden" id = "picssn" name="picssn" value="qweweqwq">
</div>
<div class="row" style="width:150px;">
<input type="submit" value="Upload" />
</div>
</form>
当我单击提交按钮时,我在此页面上有 PHP 可以很好地处理它。 $_FILES 用于接收文件,$_POST 用于读取隐藏输入附带的 picssn。但是由于 Jquery mobile 的问题,我现在不能使用 submit 或 .submit() 。所以我想用
$.post('myphpfile.php', {picssn:$('#picssn').value(), file: $('#fileToUpload').xxxxxxxxxxxxxxxxx });
相反。但我不知道如何从该表单中获取文件并以这种方式发送。有什么方法可以代替 xxxxxxxxxxxxxx 吗?谢谢!
【问题讨论】:
标签: php jquery html ajax jquery-mobile