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 rename file #14

Open
AmineHouari98 opened this issue Oct 8, 2021 · 4 comments
Open

add rename file #14

AmineHouari98 opened this issue Oct 8, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@AmineHouari98
Copy link

as the title said it would be nice to add a way to add a middleware to rename uploaded files before saving to local storage , i think this feature is a must when working with files !

@dmitriy-nz
Copy link
Owner

Hi, maybe add a callback function to the configuration of FormDataInterceptorConfig to get the filename before saving it to local storage?

@dmitriy-nz dmitriy-nz added the enhancement New feature or request label Oct 8, 2021
@chhonhourseng
Copy link

Could you guide me with a callback function to the configuration of FormDataInterceptorConfig to get the filename?

@tlikakur
Copy link

tlikakur commented Oct 1, 2022

Hi @AmineHouari98 @chhonhourseng

If you are using DTO, you can achieve this with @Transform decorator (class-transformer package):

@Transform(({ value }: { value: MemoryStoredFile }) => {
    value.originalName = 'new name';
    return value;
  })
file: MemoryStoredFile;

@mamlzy
Copy link

mamlzy commented Dec 6, 2022

Hi, maybe add a callback function to the configuration of FormDataInterceptorConfig to get the filename before saving it to local storage?

can you give us the example? please.

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

No branches or pull requests

5 participants