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

Enhance MapUploadedFile: Upload to Directory & Generate Unique Slugged Filenames #54912

Open
rcsofttech85 opened this issue May 13, 2024 · 0 comments

Comments

@rcsofttech85
Copy link

rcsofttech85 commented May 13, 2024

Description

Q A
Branch 7.1
Bug fix? no
New feature? yes
Deprecations? no
Issues Fix #
License MIT

This issue proposes an enhancement to the MapUploadedFile

Specify Upload Directory: Allow developers to define the target directory for uploaded files using a directory option. This provides
flexibility in managing file storage locations within the project.

Generate New Filename: Enable the generation of unique filenames during upload. This avoids potential conflicts and improves file organization.

Example

    #[Route(path: '/user/picture', name: 'upload_route', methods: ['POST'])]
    public function changeUserPicture(
        #[MapUploadedFile(constraints: [
            new Assert\File(mimeTypes: ['image/png', 'image/jpeg']),

        ], directory: '/public/uploads'
        )] string $pictureName
    ): Response {
       // $product->setPictureName($pictureName);
    }
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

No branches or pull requests

1 participant