文件低于8MB工作,更大的don';t


files below 8MB work, bigger don't

我使用的是uploadify v.3.2,我在一个旧项目中也使用过它,它在那里工作得很好!

但现在我正在尝试在另一台服务器上上传高达500 MB的文件。但该脚本只上传7.9 MB的文件。。。

我的php-info告诉:

上传_max_filesize 512M

后置_max_size 512M

这是我在HTML模板中使用的脚本:

        $(function() {
            $('#data').uploadify({
                'formData'     : {
                'timestamp' : '1349443065',
                'token'     : '94a031393fe2f786fdfc14c0cd432204'
                },
                'swf'      : './includes/uploadify.swf',
                'uploader' : './includes/uploadify.php',
'buttonText' : 'choose file',
'onUploadSuccess' : function(file, data, response) {
            alert('Die Datei ' + file.name + ' wurde erfolgreich hochgeladen!'); },
'checkExisting' : './includes/check-exists.php'
            });
        });

这是uploadify.php:的代码

// Define a destination
$targetFolder = '/upload'; // Relative to the root
$verifyToken = md5('unique_salt' . $_POST['timestamp']);
if (!empty($_FILES) && $_POST['token'] == $verifyToken) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
    $targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name'];
    // Validate the file type
    $fileTypes = array('zip','rar','sit'); // File extensions
    $fileParts = pathinfo($_FILES['Filedata']['name']);
$dateiname = $targetFile;   
$ersetzen = '/homepages/37/d24392003/htdocs/modx/upload/';
$dateiname = str_replace($ersetzen, "", $dateiname);    
    if (in_array($fileParts['extension'],$fileTypes)) {
        move_uploaded_file($tempFile,$targetFile);
        mail('123@abc.com', 'Dateiupload', "Es wurde eine neue Datei hochgeladen'n'nDateiname: $dateiname", "from:123@abc.de");
    } else {
        echo 'Invalid file type.';
    }
}

所以脚本可以工作,php配置似乎很好。。。有人喝了酒该怎么办?

干杯!

将文件大小限制设置为选项:'fileSizeLimit' : '500MB',

$(function() {
    $('#data').uploadify({
        ...
        'fileSizeLimit' : '500MB', // added this, set to whatever value you like
        ...
    });
});

然后将此添加到主.htaccess文件中,以覆盖服务器上的任何默认限制(包括覆盖php.ini文件):

php_value upload_max_filesize 500M
php_value post_max_size 500M

如果您正在获取500 - Internal Server Error,这可能意味着您无权通过.htaccess设置这些值。您必须联系您的网络服务器提供商。要求他们允许您设置AllowOverride选项。

选项B:

创建一个php.ini文件,并将其存储在与.htaccess文件相同的根目录中。将上面的两行相加,看看是否有效。如果使用最后一种方法得到500 Internal错误,这可能也不起作用。但你可以试试。

您是否尝试过使用phpinfo();查看php.ini设置是否已实际加载?查看加载了哪个php.ini文件。

最后,根据我的经验,如果加载了正确的php.ini文件,但没有出现更改,请尝试重新安装php,这是最后的手段

希望这能有所帮助!