我有一个提交文件的表单,当我点击“提交”按钮时,我运行了一个jquery脚本并以百分比显示上传进度。上传百分比为100%后,我希望页面像往常一样继续上传POST表单(重定向到action =''中指定的页面)但是当我使用jquery重定向页面时我无法再获取
$_POST['']
数组和所有变量。
我的问题是:如何在没有.ajaxForm的情况下访问刚刚上传的所有$ _POST变量?
所以没有.ajaxForm我会在文件上传后立即重定向,我可以访问$ _POST数组,而$ _POST ['Submit']是真的,我想保持同样的方式,但只是为了添加进度上传栏,因为表单用于上传视频(大文件),我想让用户知道视频上传进度的位置。所以我希望成功重定向到操作页面,并能够访问那里的所有$ _POST变量。
请帮帮我!!!
JQUERY和HTML
<!doctype html>
<head>
<style>
.progress { position:relative; width:400px; border: 1px solid #ddd; padding: 1px; border-radius: 3px; }
.bar { background-color: #B4F5B4; width:0%; height:20px; border-radius: 3px; }
.percent { position:absolute; display:inline-block; top:3px; left:48%; }
</style>
</head>
<body>
<form action="videator-b.php" method="post" enctype="multipart/form-data">
<input type="file" name="theFile"><br>
<input type="submit" name='Submit' value="Upload File to Server">
</form>
<div class="progress">
<div class="bar"></div >
<div class="percent">0%</div >
</div>
<div id="status"></div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
<script src="http://malsup.github.com/jquery.form.js"></script>
<script>
(function() {
var bar = $('.bar');
var percent = $('.percent');
var status = $('#status');
$('form').ajaxForm({
beforeSend: function() {
status.empty();
var percentVal = '0%';
bar.width(percentVal)
percent.html(percentVal);
},
uploadProgress: function(event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
bar.width(percentVal)
percent.html(percentVal);
},
complete: function(xhr) {
status.html('Wait please, redirecting...');
window.location.replace("//this is where I want to redirect to videator-b.php but be able to access $_POST array the is beinguploaded');
}
});
})();
</script>
</body>
</html>
PHP
<?php require_once ('esse.php');
if(isset($_POST['Submit'])){
$fileName = trim($_FILES['theFile']['name']);
$fileTempName = $_FILES['theFile']['tmp_name'];
$ext = pathinfo($fileName, PATHINFO_EXTENSION);
$size = $_FILES['theFile']['size'];
}
?>