【发布时间】:2012-07-26 12:32:16
【问题描述】:
我想使用 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);
}
});
});
上传.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);
}
关于我做错了什么有什么想法吗?
【问题讨论】:
-
显示什么错误?当你测试它时会发生什么?为什么您没有接受任何问题的答案?
-
这个其他问题可能对stackoverflow.com/questions/4072889/…有帮助
-
错误未显示。只需简单地完成该过程。但文件不会移动到目标文件夹。如果我上传图像文件,那么它会移动。 @Alfabravo
-
您是否考虑过在Uploadify Forums 上寻求支持?可能是个好主意。
标签: php javascript jquery upload