[英]Symfony2 Sonata Media Bundle — Error while uploading Image
I updated the composer.json. 我更新了composer.json。 Everything was working fine except the media section of sonata media bundle.
一切都很好,除了奏鸣曲媒体包的媒体部分。 When i upload any image i got a error
当我上传任何图像时,我收到了错误
I haven't changed any configuration. 我没有改变任何配置。 I am not able to figure the problem.
我无法解决问题。 I also give full permission to uploads folder recursively.
我还提供了递归上传文件夹的完全权限。
I also getting some exception 我也有一些例外
CRITICAL - Uncaught PHP Exception RuntimeException: "Could not write the "default/0001/01/46475120624f7b54c71ddf500322b395e3d598da.jpeg" key content." at /vendor/knplabs/gaufrette/src/Gaufrette/Filesystem.php line 111
Anyone faced this type of error 任何人都面临这种错误
You just need to change the permissions of web folder in your appliaction. 您只需要在应用程序中更改Web文件夹的权限。 eg chmod 777 web/* -Rf
例如chmod 777 web / * -Rf
I got the same issue on my Linux server. 我的Linux服务器上遇到了同样的问题。
My problem was that my Apache user wasn't the owner of my upload folder (Folder set in config/sonata_media.yml). 我的问题是我的Apache用户不是我上传文件夹的所有者(在config / sonata_media.yml中设置了文件夹)。 For reference, mine is : %kernel.root_dir%/../web/uploads/media
作为参考,我的是:%kernel.root_dir%/ .. / web / uploads / media
What I did was: 我做的是:
1) Logging as sudoer in my Linux server 2) Going to the parent folder of my uploads folder. 1)在我的Linux服务器中记录为sudoer 2)转到我的uploads文件夹的父文件夹。 So /web folder 3) Changing the user of the uploads folder with: chown -R apache-user uploads 4) Changing the group of the uploads folder with: chgrp -R apache-group uploads 5) Typing ls -ltr to confirm that my apache user is now the owner
所以/ web文件夹3)使用以下命令更改uploads文件夹的用户:chown -R apache-user uploads 4)使用以下命令更改uploads文件夹的组:chgrp -R apache-group uploads 5)键入ls -ltr以确认我的apache用户现在是所有者
Locally, on Windows, I just set the folder to have write rights. 在本地,在Windows上,我只是将文件夹设置为具有写权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.