Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FileField for Files. #6587

Open
wants to merge 1 commit into
base: 4.x
Choose a base branch
from

Conversation

bytes-commerce
Copy link
Contributor

@bytes-commerce bytes-commerce commented Nov 27, 2024

There are constraint issues when attempting to upload a PDF file trough the only "Upload" field there is right now: ImageField. As stated in this task, it might be valuable to have a middle-class (FileField) that is just extended by the ImageField.

@Seb33300
Copy link
Contributor

Seb33300 commented Jan 7, 2025

Even if the ImageField is not really suitable for other type of field, you can override the image constraint on the ImageField like this if you still want to upload something else:

ImageField::new(...)
    ->setFileConstraints(new Assert\File(['extensions' => 'pdf']))

But I agree a new FileField is welcome

@bytes-commerce
Copy link
Contributor Author

Overriding alone is not sufficient, as it will cause other issues in the core code as far as I remember, since I've tried that before if I am not mistaken... :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants