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

I there any way to make different storage for each field? #1050

Closed
njm-dev opened this issue Nov 19, 2021 · 3 comments
Closed

I there any way to make different storage for each field? #1050

njm-dev opened this issue Nov 19, 2021 · 3 comments

Comments

@njm-dev
Copy link

njm-dev commented Nov 19, 2021

I want to save pdf files in pdf named folder and images in the image named folder, Is there any way to do that?

@LinusU
Copy link
Member

LinusU commented Nov 19, 2021

Unfortunately, there is no great way to do this with the model that is used in Mutler 1.x.

However, with the 2.x version this should be very easy! You can try it out and provide feedback in #399.

Closing this since it cannot really be solved in the library for 1.x...

@LinusU LinusU closed this as completed Nov 19, 2021
@njm-dev
Copy link
Author

njm-dev commented Nov 19, 2021

Well, @LinusU I solved this using file.filedname
if(file.fieldname === "image"){
cb(null, "./uploads/images");
} else if (file.fieldname === "pdf"){
cb(null, "./uploads/pdf");
}

@LinusU
Copy link
Member

LinusU commented Nov 19, 2021

Ah, I thought you wanted to detect the file type and then act. Yes, the solution you posted will work great for your use case 👍

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

2 participants