0

我想使用 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);
}

关于我做错了什么的任何想法?

4

1 回答 1

1

您可能只需要增加最大上传限制即可阅读http://css-tricks.com/snippets/php/increase-maximum-php-upload-size/

于 2012-07-26T12:59:05.680 回答