-
Notifications
You must be signed in to change notification settings - Fork 11
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
Create a file upload component #2
Comments
I'll come back to this as soon as this is complete: redux-autoform/redux-autoform#45 Having the features we have now working, tested and DOCUMENTED is far more important than adding new features. |
100% agree with you @andrerpena! I will try to add test for components with enzyme. |
+1, really.. Enzyme seems really great |
@andrerpena the guys from airbnb are really good with js! |
This comment is to remember how to configure a FileUpload!! 😄 In order to obtain the file data sent by a multipart/form-data content type, we should use the multer middleware (https://github.com/expressjs/multer). import multer from 'multer';
const storage = multer.diskStorage({
destination: function(request, file, callback) {
callback(null, "./demo/uploads");
},
filename: function(request, file, callback) {
callback(null, file.originalname + '-' + Date.now())
}
}); After that you create an instance of multer with the configured storage: const upload = multer({storage}); And finally you should use that multer instance in each route that will receive the multipart data: router.post("/upload", upload.array("fileData"), (request, response) => {
/* Some awesome stuff */
} IMPORTANT The data you append to the FormData class in a FileUpload should have the same name you use when you use the upload.array/single/files functions, in our case, we are sendind the fileUpload data as fileData |
Things TODO:
Actually the FileUpload looks like this: |
Added modal to confirm delete! I have merged this now because we need to use @andrerpena, I will work on fix the TabGroup minor bugs and test all the components, because I have make the coverage decrease 😞 but I promise the coverage will increase!! 😄 |
I will keep this issue open since there are so much things to do to get it as we want |
@JonatanSalas and @danigomez . I've been away for a while but I'm back now and trying to get up to speed again. First, you've been doing a fantastic job with this component. I got a few questions:
Another note, I added support for Again.. Amazing job. |
@andrerpena here you have the explanations:
What's your opinion? |
Thanks @JonatanSalas
|
|
I like the idea for a FileUpload project!!! That way we can reuse it in the other UIs!! 😄 PS: 🎉 🍰 🍰 🎉 😄 |
@danigomez the only case this will be different it's with material.. so we have to think on how to style it or make something that mix well with any UI |
|
@JonatanSalas I agree that styling is a problem. Maybe we could have a base headless component and than one component for each UI. |
Add support for drag and drop file upload component
The text was updated successfully, but these errors were encountered: