【问题标题】:vich uploader image going to xampp as temp filevich 上传器图像将作为临时文件发送到 xampp
【发布时间】:2018-11-15 18:04:46
【问题描述】:

您好,我正在使用 vich upload 上传图片,并将路径名返回为。

图片正在上传并显示在简易管理员中。 但是突然它开始不再加载图像了,我发现目标目录已更改为 ->

C:\xampp_\tmp\phpB51C.tmp

我的 vich 映射是这样的

mappings:
    manchete_images:
        uri_prefix:  '\uploads\images\manchetes' 
        upload_destination:  '%kernel.project_dir%/public/uploads/images/manchetes'

图像正常显示,然后突然开始损坏并且不在公共目录中创建文件上传文件

【问题讨论】:

  • 你能清除你的缓存吗?你能检查一下你的磁盘下是否有足够的内存吗?
  • @AhmedEBENHASSINE 好吧,我的磁盘有很多 GB 的空白空间。关于缓存...你到底指的是什么?我的意思是什么样的缓存?浏览器缓存?窗口缓存?我在哪里可以找到这个缓存?
  • 应用缓存:只要提交这个命令 bin/console cache:clear
  • 随你喜欢,我可以帮助你使用easyadmin bundle,如果你想在pensource上设置项目,我知道我会帮助你
  • 顺便提一下easyadmin的demo你可以查看github.com/javiereguiluz/easy-admin-demo

标签: symfony image-uploading vichuploaderbundle


【解决方案1】:

尝试将uri_prefix: '\uploads\images\manchetes' 中的\ 更改为/,然后重试。

【讨论】:

    【解决方案2】:

    正如 Ez 提到的,您需要更改 uri_prefix 中的 \。
    其次,您的 easy_admin 配置 的编辑表单存在问题。
    您需要在表单下使用caminhoDaImagem 属性而不是arquivoDaImagem,新建或编辑配置...并且文件类型应从文件更改为vich_file 或vixh_image。 ..文档https://symfony.com/doc/master/bundles/EasyAdminBundle/integration/vichuploaderbundle.html#uploading-the-images-in-the-edit-and-new-views中已经提到过

    easy_admin:
        entities:
            Product:
                # ...
                form:
                    fields:
                        - { property: 'imageFile', type: 'vich_image' }
    

    我修复了你的代码,你可以看到我的 PR

    【讨论】:

      猜你喜欢
      • 2023-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-23
      • 2011-10-08
      • 1970-01-01
      相关资源
      最近更新 更多