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
docs(examples): added file upload example #1808
docs(examples): added file upload example #1808
Conversation
Hi @marvinwu, Welcome, and thank you for contributing to Remix! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at hello@remix.run. Thanks! - The Remix team |
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
@kentcdodds can you review this example and merge when you're ready? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! I've got a few bits of feedback for this one.
examples/file-and-cloudinary-upload/app/routes/cloudinary-upload.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
7e5cea8
to
f1503b7
Compare
f1503b7
to
0725607
Compare
Co-authored-by: Michaël De Boey <info@michaeldeboey.be>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet! This is very cool 👍
Thanks everyone 👏👏 |
import cloudinary from "cloudinary"; | ||
import type { Stream } from "stream"; | ||
|
||
dotenv.config(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this example! Just a question about environment variables: according to Remix docs dotenv
should only be used when starting the development script via node -r
, see server environment variables. However, I prefer your way much better. Is there something wrong with it then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I always avoid calling it via code. It's a potential source of bugs if you ship a ".env" to production by accident.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed! Fixed 👍
upload file and images
This is a simple example of using the remix buildin uploadHandler and Form with multipart data to upload an image file and display it,
it also show a simple(though not efficient way) of integrate with cloudinary without writing custom handler.
the relevent files are:
steps to set up cloudinary