【问题标题】:Max File Size in roxy filemanroxy fileman 中的最大文件大小
【发布时间】:2017-07-19 12:52:08
【问题描述】:

有没有办法设置最大文件限制。 我已经搜索了谷歌并找到了这段代码(这段代码不起作用):

function addFile() {
clickFirstOnEnter('dlgAddFile');

var dialogButtons = {};
dialogButtons[t('Upload')] = function () {
var maxtotal = RoxyFilemanConf.MAXTOTAL;
var maxfilesize = RoxyFilemanConf.MAXFILESIZE;
var fileoversize = "";
var totalsize = 0;
if (!$('#fileUploads').val())
alert(t('E_SelectFiles'));
else {
if (!RoxyFilemanConf.UPLOAD) {
alert(t('E_ActionDisabled'));
//$('#dlgAddFile').dialog('close');
}
else {
var files = $('#fileUploads')[0].files;
for (var i = 0; i < files.length; i++) {
//alert(files[i].name);
totalsize += files[i].size;
if ((files[i].size / 1024) > maxfilesize) {
fileoversize = files[i].name + '\n';
}
}

if ((totalsize / 1024 / 1024) > maxtotal) {
alert(t('E_MAXSIZE') + ". Set to " + maxsize + "MB.");
}
else if (fileoversize != "") {
alert("Max total upload : "+ maxfilesize +"KB. Oversized files:\n" + fileoversize);
}
else {
document.forms['addfile'].action = RoxyFilemanConf.UPLOAD;
document.forms['addfile'].submit();
}
}
}
};
dialogButtons[t('Cancel')] = function () { $('#dlgAddFile').dialog('close'); };

$('#dlgAddFile').dialog({ title: t('T_AddFile'), modal: true, buttons: dialogButtons });
}

Adding 2 variables to conf.json
MAXTOTAL and MAXFILESIZE. 

但这根本不起作用.. 有人对此问题有任何建议/解决方案吗?

【问题讨论】:

    标签: php file manpage roxy-fileman


    【解决方案1】:

    正如 OP 已经发现的那样,这是一个配置设置。对于在 .Net 中搜索解决方案的人,需要在 IIS 7.0+ 的 web.config 中进行两项更改。查看链接了解更完整的详细信息。

    我将元素添加到我的根 web.config。

    <system.web>
        <!-- Max int value of 2gb --> 
        <httpRuntime maxRequestLength="2097151" appRequestQueueLimit="100000" requestLengthDiskThreshold="2097151" />    
    </system.web>
    <system.webServer>
         <security> 
            <requestFiltering> 
                <!-- maxAllowedContentLength, for IIS, in bytes --> 
                <requestLimits maxAllowedContentLength="104857600" ></requestLimits>
            </requestFiltering> 
        </security>
    </system.webServer>
    

    酱: How to increase the max upload file size in ASP.NET?

    我还更新了代码以在 1.4.5 版中按预期工作。确保将其应用于 main.js/main.min.js 文件。

    function addFile() {
        clickFirstOnEnter("dlgAddFile");
        $("#uploadResult").html("");
        clearFileField();
        var a = {};
        a[t("Upload")] = {
            id: "btnUpload",
            text: t("Upload"),
            disabled: true,
            click: function () {
                if (!$("#fileUploads").val() && (!uploadFileList || uploadFileList.length == 0)) {
                    alert(t("E_SelectFiles"))
                } else {
                    if (!RoxyFilemanConf.UPLOAD) {
                        alert(t("E_ActionDisabled"))
                    } else {
                        // start of change
                        var maxtotal = RoxyFilemanConf.MAXTOTAL;
                        var maxfilesize = RoxyFilemanConf.MAXFILESIZE;
                        var fileoversize = "";
                        var totalsize = 0;
    
                        for (var i = 0; i < uploadFileList.length; i++) {
                            totalsize += uploadFileList[i].size;
                            if ((uploadFileList[i].size / 1024) > maxfilesize) {
                                fileoversize = fileoversize + uploadFileList[i].name + '\n';
                            }
                        }
    
                        if ((totalsize / 1024 / 1024) > maxtotal) {
                            alert(t('E_MAXSIZE') + ". Set to " + maxsize + "MB.");
                        } else if (fileoversize != "") {
                            alert("Max total upload : " + maxfilesize + "KB. Oversized files:\n" + fileoversize);
    
                        } else // end of change
                        if (window.FormData && window.XMLHttpRequest && window.FileList && uploadFileList && uploadFileList.length > 0) 
                        {
                            for (i = 0; i < uploadFileList.length; i++) {
                                fileUpload(uploadFileList[i], i)
                            }
                        } else {
                            document.forms.addfile.action = RoxyFilemanConf.UPLOAD;
                            document.forms.addfile.submit()
                        }
                    }
                }
            }
        };
        a[t("Cancel")] = function () {
            $("#dlgAddFile").dialog("close")
        };
        $("#dlgAddFile").dialog({
            title: t("T_AddFile"),
            modal: true,
            buttons: a,
            width: 400
        })
    }
    

    【讨论】:

      【解决方案2】:

      (代表 OP 发布).

      这是固定的。我发现max文件正在通过php.ini。

      upload_max_filesize=4M
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-03-14
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多