Uploadify3.1上傳5M以上檔案顯示成功,實際沒上傳成功
PHP Uploadify3.1上傳4M多的可以上傳成功,上傳大點的,進度條和提示都顯示成功,但實際檔案沒上傳成功,調試環境IIS6
,可以確認路徑沒問題,操作應該也沒問題,是不是uploadify本身不能上傳大檔案?還有沒有其他好的上傳大檔案的PHP外掛程式介紹。
JS代碼如下
JScript code
$(function() { $('#file_upload').uploadify({ 'swf' : 'uploadify.swf', 'uploader' : 'uploadify.php', 'buttonText':'上傳', 'auto' : false, 'height': 24, 'width': 50, 'cancelImage': 'uploadify-cancel.png', 'checkExisting':'check-exists.php', 'multi':false, 'fileDataName': 'Filedata', 'fileTypeDesc': 'FLV視頻檔案和圖片檔案', 'fileTypeExts':'*.flv;*.jpg;*.iso', 'onUploadError' : function(file,errorCode,errorMsg,errorString,swfuploadifyQueue){ alert(errorMsg);//上傳檔案出錯是觸發(每個出錯檔案觸發一次) }, 'onUploadSuccess':function(file,data,response){ alert( 'id: ' + file.id+ ' - 索引: ' + file.index+ ' - 檔案名稱: ' + file.name + ' - 檔案大小: ' + file.size+ ' - 類型: ' + file.type+ ' - 建立日期: ' + file.creationdate+ ' - 修改日期: ' + file.modificationdate+ ' - 檔案狀態: ' + file.filestatus + ' - 伺服器端訊息: ' + data+ ' - 是否上傳成功: ' + response); } // Your options here }); });
PHP上傳檔案uploadify.php代碼如下
PHP code
$targetFolder = '/uploads'; // Relative to the rootif (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder; $targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name']; // Validate the file type $fileTypes = array('jpg','jpeg','gif','png','flv','iso'); // File extensions $fileParts = pathinfo($_FILES['Filedata']['name']); if (in_array($fileParts['extension'],$fileTypes)) { move_uploaded_file($tempFile,$targetFile); echo '1'; } else { echo 'Invalid file type.'; }}
------解決方案--------------------
不是程式就是環境限制了上傳大小
------解決方案--------------------
探討
大哥可否說詳細點 這個上傳不上分塊上傳的嗎?
如果不上分塊的 估計肯定是上傳不了的
------解決方案--------------------
if (!empty($_FILES)) {
if($_FILES['Filedata']['error'] != 0) die('錯誤號碼:' . $_FILES['Filedata']['error']);
$tempFile = $_FILES['Filedata']['tmp_name'];
....
------解決方案--------------------
php.ini設定max_post_size大於等於5m就行了