无法在Wordpress中导入Divi布局

时间:2017-10-14 03:39:47

标签: wordpress wordpress-theming

尝试导入Divi布局(.json文件) 得到此错误:

This file cannot be imported. It may be caused by file_uploads being 
disabled in your php.ini. It may also be caused by post_max_size or/and 
upload_max_filesize being smaller than file selected. Please increase 
it or transfer more substantial data at the time.

但事实并非如此,因为我对这两者都没有限制,我可以在我的WP安装中的任何其他位置上传。

有没有人知道还有什么会导致这个错误?

2 个答案:

答案 0 :(得分:0)

我的回复与Divi Theme Version 3.0.46相关

我遇到了同样的问题,接下来是我如何修复它。

在我的情况下,错误是从Divi Builder portability.js文件生成的,第464行:

this._router.navigate([
    'projects',
    getUrlParameterByChild('servers', route),
    'servers'
])

这里要注意的是,这个脚本将最大上传大小四舍五入为整数MB。

所以这个网站的最大文件大小是2MB,我的文件是1,495,679字节,脚本变成了:

var fileSize = Math.ceil( ( data.file.size / ( 1024 * 1024 ) ).toFixed( 2 ) ),
    formData = new FormData();

// Max size set on server is exceeded.
if ( fileSize >= $this.postMaxSize || fileSize >= $this.uploadMaxSize ) {
    etCore.modalContent( '<p>' + $this.text.maxSizeExceeded + '</p>', false, true, '#' + $this.instance( '.ui-tabs-panel:visible' ).attr( 'id' )\
    );

    $this.enableActions();

    return;
}

所以看起来,解决方案是让两者你的php上传最大尺寸和最大邮件大小至少1MB 大于你试图上传的文件。< / p>

优雅主题人们对此有一个冗长的帖子:

https://www.elegantthemes.com/blog/tips-tricks/is-the-wordpress-upload-limit-giving-you-trouble-heres-how-to-change-it

这就像在我的php.ini中设置它一样简单。

if 2>=2 {
    // throw an error
}

我想说的最后一件事,因为这个错误是由浏览器中的javascript生成的,你必须:

  • 更改你的php.ini
  • 重新启动您的网络服务器[至少我需要使用Apache]
  • 刷新页面,因为限制在浏览器中缓存,而不是任何类型的ajax调用的结果等。

答案 1 :(得分:0)

我有同样的问题。我用谷歌搜索并找到了下面的解决方案。(没有正确解释的道歉!)

解决方案: 使用以下文字&amp;创建一个新文件php.ini。保存在网站的根目录中并完成。

file_uploads = On
upload_max_filesize = 100M
post_max_size = 100M