我想使用Uploadify和PHP上傳.wmv和.flv文件。但是,我似乎無法做到。使用PHP上傳.WMV和.FLV
這裏是我的代碼:
$(function() {
$("#file_upload").uploadify({
'swf' : 'uploadify/uploadify.swf',
'uploader' : 'uploadify/uploadify.php',
'uploadLimit' : 1,
'folder' : 'uploads',
'method' : 'post',
'auto' : true,
'multi' : true,
'fileExt' : '*.jpg; *.gif; *.png; *.jpeg; *.wmv; *.flv',
'onUploadSuccess' : function(file, data, response) {
alert('The file was saved to: ' + file);
}
});
});
Uplodify.php
$targetFolder = '/uploads'; // Relative to the root
if (!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','wmv'); // File extensions
$fileParts = pathinfo($_FILES['Filedata']['name']);
move_uploaded_file($tempFile,$targetFile);
}
任何想法,我做錯了嗎?
顯示的是什麼錯誤?當你測試它會發生什麼?爲什麼你沒有接受任何問題的答案? – Alfabravo 2012-07-26 12:34:28
這個其他問題可能會幫助http://stackoverflow.com/questions/4072889/uploadify-alternative-need-to-upload-large-1gb-files – williamvicary 2012-07-26 12:34:54
錯誤不顯示。只需簡單地完成該過程。但文件不會在目標文件夾上移動。如果我上傳圖像文件,那麼它會移動。 @Alfabravo – 2012-07-26 12:43:23