2
我已經在我的php網站中集成了uploadify 3.1。uploadify視頻上傳問題和302錯誤
問題:我的uploadify腳本適用於較小的視頻。視頻文件上傳到目標文件夾並存儲到數據庫中。
1)對於低於50 MB的視頻文件 - 上傳的視頻是好的,但在完成上傳100%後,它給302錯誤雖然視頻的目標文件夾中上傳和信息存儲到數據庫中了。
2)對於50 MB以上的視頻文件 - 視頻上傳狀態顯示視頻上傳100%。獲得100%上傳狀態進度條後,視頻不會上傳到目標文件夾中,也不會存儲到數據庫中。
請幫忙解決這些問題。我儘可能提供儘可能多的信息。
下面的東西IIS服務器上設置,這樣是不是問題。
php 5.2.7
mysql
max_execution_time = 10800 seconds
max_input_time = 10800 seconds
memory_limit = 512M
post_max_size = 512M
upload_max_filesize = 512M
Fast CGI Timeout = 3600 seconds
下面是網站結構
admin (folder)
video/video_add.php (upload page location inside admin folder)
video/video_add_p.php (upload programming where file is being uploaded and stored into database)
data (folder)
video (video files will be stored inside this folder)
以下文件包含video_add.php頁面上
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="jquery.uploadify-3.1.min.js" type="text/javascript"></script>
下面是video_add.php頁面
<script type="text/javascript">
<?php $timestamp = time();?>
$(function() {
$('#file_upload').uploadify({
'auto' : true,
'buttonText' : 'SELECT AND UPLOAD VIDEO',
'checkExisting' : './check-exists.php',
'fileSizeLimit' : '200MB',
'fileTypeDesc' : 'Video Files',
'fileTypeExts' : '*.flv; *.mp4; *.mpg; *.mpeg; *.wmv; *.FLV; *.MP4; *.MPG; *.MPEG; *.WMV;',
'formData' : {
'timestamp' : '<?php echo $timestamp;?>',
'token' : '<?php echo md5('unique_salt' . $timestamp);?>',
'pkid' : '<?php echo $int_pkid;?>',
},
'method' : 'post',
'multi' : false,
'progressData' : 'speed',
'removeCompleted' : false,
'swf' : 'uploadify.swf',
'uploader' : './video_add_p.php',
'uploadLimit' : 1,
'width' : 250,
'onSelect' : function() {
if(trim(txt_title.value)=="")
{
alert("Please enter video name.");
txt_title.focus();
$('#file_upload').uploadify('cancel');
return false;
}
},
'onSelectError' : function() { alert('The file returned an error and was not added to the queue.');},
'onUploadStart' : function() { $("#file_upload").uploadify('settings', 'formData', {'txt_title': $('#txt_title').val()}); },
'onUploadComplete' : function() { location.reload(true); },
});
});
上uploadify設置
下面是輸入按鈕,選擇視頻文件
<input type="text" id="txt_title" name="txt_title" size="90">
<input type="file" id="file_upload" name="file_upload" placeholder="Select your file to upload">
下面是video_add_p.php節目上傳視頻
$targetFolder = "../../data/video/"; // Relative to the root
$verifyToken = md5('unique_salt' . $_POST['timestamp']);
if (!empty($_FILES) && $_POST['token'] == $verifyToken) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $targetFolder;
$targetFileExt=GetExtension($_FILES['Filedata']['name']);
$targetFileName = "video_".$int_pkid."_".date("ymdhis").".".$targetFileExt;;
$targetFile = rtrim($targetPath,'/') . '/' . $targetFileName;
// Validate the file type
$fileTypes = array('flv','mp4','mpg','mpeg','wmv','FLV','MP4','MPG','MPEG','WMV');
// File extensions
$fileParts = pathinfo($_FILES['Filedata']['name']);
if (in_array($fileParts['extension'],$fileTypes)) {
set_time_limit(0);
move_uploaded_file($tempFile,$targetFile);
echo '1';
}
else { echo 'Invalid file type.'; }
}
-- Here script is written to store uploaded video file data into mysql database. --
感謝您的答覆,但它並不能幫助。 – KRA 2013-03-11 07:31:23