duan97689 2016-07-09 10:07
浏览 202
已采纳

上传图像SilverStripe时,PHP错误'Filesize为零字节'

I have just set up a new Centos 7 server and uploaded my SilverStripe project via a Capistrano deployment. All is working well except for the file upload where I get a 'Filesize zero bytes' when uploading images.

The assets folder is symlinked to a shared folder outside of the website root.

website
- current
- - (website root)
- shared
- - assets
- - - (uploads)
- - vendor
- - - (composer managed deps)

The file I am uploading is 16kb.

Permissions on all files and directories are set to deployer:apache 755 and permissions on the assets folder has been set to 775 (set it to 777 still with no luck).

There was another post I read that mention php config could be an issue. Here are some of the relevant php settings:

  • max_execution_time: 30
  • max_file_uploads: 20
  • max_input_time: 60
  • post_max_size: 8M
  • upload_max_filesize: 2M
  • upload_tmp_dir: /tmp

Not sure if there are any others that may be on interest, let me know and I will post them.

  • 写回答

1条回答 默认 最新

  • dorbmd1177 2016-07-11 00:07
    关注

    This is usually due to permissions on the assets directory.

    Change the owner of both the symlink and the folder it is linked to

    sudo chown -R deployer:apache assets
    sudo chown -R deployer:apache /path/to/assets
    

    You might also need to do sudo chmod g+w assets and sudo chmod g+w /path/to/assets to allow other group members to write to your directory.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?