서버에 파일을 업로드하는 동안 진행률 막대를 시각화하기 위해 Malsup's jQuery File Upload Progress Bar을 사용하고 있습니다. 지금 현재 사용 중입니다. 진행 표시 줄은 파일 크기가 10 개 이상의 MB입니다 경우 100 % Malsup의 jQuery 파일 업로드 진행 막대를 사용하여 업로드가 실패합니다.
2
를) 달성되지 않은 경우에도 그것은 100 % 개까지로드1) 업로드 파일 :이 플러그인에 다음과 같은 의문을 가지고있다 진행 막대 및 에코 업로드에 실패했습니다! 메시지. 파일 업로드에 대한
<?php
$upload_directory = "../users/Files/";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_directory . $_FILES['userfile']['name'])) {
print "<br><br>";
print "<font color='black'>File Uploaded Successfully</font>";
print "<br><br>";
print "<font color='black'>Uploaded File is {$_FILES['userfile']['name']} and its size is {$_FILES['userfile']['size']} bytes </font>";
} else {
print "Upload failed!";
}
?>
내 서버 설정 : PHP에서
post_max_size 1050M 1050M
upload_max_filesize 1050M 1050M
upload_tmp_dir /tmp /tmp
설정 -> file.php 코드
<!doctype html>
<head>
<title>Uploads</title>
<style>
body { padding: 30px }
form { display: block; margin: 20px auto; background: #eee; border-radius: 10px; padding: 15px }
.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>
<h1>File Upload</h1>
<form action="file.php" method="post" enctype="multipart/form-data">
<input type="file" name="myfile[]" multiple><br>
<input type="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);
//console.log(percentVal, position, total);
},
complete: function(xhr) {
status.html(xhr.responseText);
}
});
})();
</script>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript">
_uacct = "UA-850242-2";
urchinTracker();
</script>
양식 조치 : 여기
코드입니다 .ini :max_execution_time = 30 ; Maximum execution time of each script, in seconds
max_input_time = -1
memory_limit = 2000M ; Maximum amount of memory a script may consume (8MB)
하지만 좀 더 오류가, 나는 그것이 – Telgin
30 초 후 ... 시간 초과있어 확실하지 않다있다, PHP 스크립트는 전체 파일을 업로드하지 않았더라도 응답을 중지하고 실패한 ajax 함수에 응답을 반향합니다. –
@AhhishekSaha, 답장을 보내 주셔서 감사합니다. 파일 크기 제한이 10MB를 초과하는 경우 업로드 실패를 표시하지만이 태그를 추가했습니다! 메시지 .. – highlander141