我想使用Uploadify和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);
}
关于我做错了什么的任何想法?
答案 0 :(得分:1)
如果读取http://css-tricks.com/snippets/php/increase-maximum-php-upload-size/
,您可能只需要增加最大上传限制