Javascript 使用js与php自动上传PDF文件
我有这样的php代码Javascript 使用js与php自动上传PDF文件,javascript,php,jquery,Javascript,Php,Jquery,我有这样的php代码 //this have loop for repeat data by $i <tr> <th>Num:</th> <th>upload</th> </tr> <tr> <td><?php echo $i?></td> <td> <div id="me<?php echo $i ?>" num="<
//this have loop for repeat data by $i
<tr>
<th>Num:</th>
<th>upload</th>
</tr>
<tr>
<td><?php echo $i?></td>
<td>
<div id="me<?php echo $i ?>" num="<?php echo $i ?>" class="styleall me" ><span ><span class="glyphicon glyphicon-folder-open uploadChange"></span></span></div><span id="mestatus<?php echo $i ?>" class="mestatus" ></span>
<div id="files<?php echo $i ?>" class="files">
<li class="success">
</li>
</div>
</td>
</tr> // end loop
//此循环用于按$i重复数据
号码:
上传
$('.uploadChange').click(function(event) {
event.preventDefault();
var num = $('.me').attr('num');
var btnUpload = $('#me'+num);
var mestatus = $('#mestatus' + num);
var files = $('.files');
new AjaxUpload(btnUpload, {
action: '/uploadDoc.php',
name: 'uploadfile',
onSubmit: function(file, ext) {
if (!(ext && /^(pdf)$/.test(ext))) {
mestatus.text('PDF files are allowed');
return false;
}
mestatus.html('<img src="/ajax-loader.gif" height="16" width="16">');
},
onComplete: function(file, response) {
mestatus.text('File Uploaded Sucessfully!');
files.html('');
}
});
});
new AjaxUpload(btnUpload, {
action: '/uploadDoc.php',
name: 'uploadfile',
onSubmit: function(file, ext) {
if (!(ext && /^(pdf)$/.test(ext))) {
mestatus.text('PDF files are allowed');
return false;
}
mestatus.html('<img src="/ajax-loader.gif" height="16" width="16">');
},
onComplete: function(file, response) {
mestatus.text('File Uploaded Sucessfully!');
files.html('');
}
});