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

用于我放置它的ddl=>。

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

我得到的错误。我启用了扩展,但它是一样的,它不起作用。你能帮我吗?我的symfony 4代码:
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.',
]),
],
]);
}你能帮我吗?我该怎么做?
发布于 2020-08-01 01:07:46
好吧,我成功了,
-I删除MAFIC上的基本环境将变量$file的orm实体类型更改为blob
现在是工作了!:)
https://stackoverflow.com/questions/62798759
复制相似问题