首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >php7 fileInfo扩展,用于上传。在‘空’.what文件加载魔术数据库失败,我忘记了吗?

php7 fileInfo扩展,用于上传。在‘空’.what文件加载魔术数据库失败,我忘记了吗?
EN

Stack Overflow用户
提问于 2020-07-08 23:59:03
回答 1查看 219关注 0票数 0

我不能上传文件到php,即使我安装了两个魔术文件到/文件目录;和;创建魔术环境变量。

用于我放置它的ddl=>。

这两个文件来自扩展fileInfo的php.net。

我得到的错误。我启用了扩展,但它是一样的,它不起作用。你能帮我吗?我的symfony 4代码:

代码语言:javascript
复制
 public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $fileConstraints=[
            new File(array(
                'maxSize' => '20M',
                'mimeTypes' => array(
                    'application/pdf'
                ),
                'mimeTypesMessage' => 'Please upload a valid PDF document',
            ))
        ];
        $builder

            ->add('firstname')
            ->add('name')
            ->add('email')
            ->add('plainPassword',RepeatedType::class,[ 'type'=>PasswordType::class,
                // instead of being set onto the object directly,
                // this is read and encoded in the controller
                'mapped' => false,
                'constraints' => [
                    new NotBlank([
                        'message' => 'Please enter a password',
                    ]),
                    new Length([
                        'min' => 6,
                        'minMessage' => 'Your password should be at least {{ limit }} characters',
                        // max length allowed by Symfony for security reasons
                        'max' => 4096,
                    ]),
                ],
                'first_options'=>['label'=>'Password'],
                'second_options'=>['label'=>'Repeat Password'],

            ])

            ->add('telephone')

            ->add('file', \Symfony\Component\Form\Extension\Core\Type\FileType::class, array('label' => 'Fichier','constraints'=>$fileConstraints))

            ->add('agreeTerms', CheckboxType::class, [
                'mapped' => false,
                'constraints' => [
                    new IsTrue([
                        'message' => 'You should agree to our terms.',
                    ]),
                ],
            ]);

    }

你能帮我吗?我该怎么做?

EN

回答 1

Stack Overflow用户

发布于 2020-08-01 01:07:46

好吧,我成功了,

-I删除MAFIC上的基本环境将变量$file的orm实体类型更改为blob

现在是工作了!:)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62798759

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档