Cloudinary Image Upload - the easiest way - mern stack

  Рет қаралды 49,070

CODING ACADEMY

CODING ACADEMY

2 жыл бұрын

We are going to teach you how to upload image in cloudinary in base 64, without any extra steps, or over complicated code, it will be very easy to follow.
👉 - Delete easily image in cloudinary: • Cloudinary delete imag...
👉 - Cloudinary upload multiple images - MDB Carousel example - MERN Stack: • Cloudinary upload mult...
👉 Cloudinary update image in backend - mern stack: • Cloudinary update imag...
👉 Github link: github.com/emmannweb/mernstac...
👉 Membership: / @emmannweb
☕ Buy me a coffee: www.buymeacoffee.com/codingac...
KZbin TUTORIALS
- Worpdress Tutorial: • Wordpress tutorial - h...
- Custom post type and taxonomy filter: • Custom post type with ...
- Cloudinary CRUD operation: • Cloudinary update imag...
- HTML and CSS Website design tutorial from scratch: • html and css website d...
- MERN Stack from scratch: • mongodb express react ...
- MERN Stack with Redux Toolkit: • Redux Tutorial / Redux...
Cloudinary Image Upload - the easiest way - mern stack
CODING ACADEMY is a programming channel that aim to teach programming stuff in a simple way.
If you are looking for Wordpress tutorial, React, MongoDB, ect this is the right channel for you.
Don´t forget To Subscribe and Share with other Friends
Subscribe To Coding academy : / @emmannweb
You Can Follow on Facebook :
CODING ACADEMY is an online media that was created to teach programming to any person around the world who feel the need to learn programming. We teach in a simple way and make it easy to understand.
Our community ( CODING ACADEMY) fans greatly appreciate this initiative,
#coding academy #Wordpress #coding

Пікірлер: 106
@TomatoCultivator219
@TomatoCultivator219 Жыл бұрын
Amazing video! I was stuck for a long time before watching this
@emmannweb
@emmannweb Жыл бұрын
Thank you. Glad to hear it!
@azimuddinahamed
@azimuddinahamed Жыл бұрын
Thanks, Brother. Much appreciation for you.
@emmannweb
@emmannweb Жыл бұрын
Thank you so much! You're welcome.
@trungkienofficial8085
@trungkienofficial8085 Жыл бұрын
Very nice and easy to know, thanks so much 😊
@emmannweb
@emmannweb Жыл бұрын
thank you so much!
@node991
@node991 2 ай бұрын
supportive video & easy to know! Thanks brother
@emmannweb
@emmannweb 2 ай бұрын
Glad you liked it!
@lokeshchauhan6253
@lokeshchauhan6253 Ай бұрын
Thanks bro i was struggling to upload for over 8 hrs thank you very much
@emmannweb
@emmannweb Ай бұрын
You're welcome!
@monj3876
@monj3876 Жыл бұрын
thank you for this tutorial!
@emmannweb
@emmannweb Жыл бұрын
You're so welcome!
@devmentor2022
@devmentor2022 Жыл бұрын
nice video thank you. I think you should describe more about the last user interface but totally I got the idea and worked with me
@emmannweb
@emmannweb Жыл бұрын
Thanks for the idea! But could elaborate better? did you suggest that i give a better look on the user interface?
@devmentor2022
@devmentor2022 Жыл бұрын
@@emmannweb yes it wasn't clear how you make the requests to your backend from client side .. so it was clear for when you were working on vscode .. but when you used the user browser I couldn't get it. But anyway it solved my problem .. 🥰🥰🥰🥰
@emmannweb
@emmannweb Жыл бұрын
​ @Dev mentor okay... Happy to hear that!
@sdsumonto2350
@sdsumonto2350 8 ай бұрын
Thanks making devs life easy ❤❤
@emmannweb
@emmannweb 8 ай бұрын
My pleasure 😊
@stickshift583
@stickshift583 Жыл бұрын
nice video thank you It worked
@emmannweb
@emmannweb Жыл бұрын
Awesome! Thank you!
@ernzotech
@ernzotech 6 күн бұрын
I am having this error "Missing required parameter - file"while trying to add a photo to cloudinary from Postman while testing it "Missing required parameter - file"
@nikkv9
@nikkv9 Жыл бұрын
Thankyou sir, your code is helped me
@emmannweb
@emmannweb Жыл бұрын
Great 👍
@gregfredder8645
@gregfredder8645 Жыл бұрын
Thank you for this video can you provide the link for the react form project?
@emmannweb
@emmannweb Жыл бұрын
github.com/emmannweb/mernstackproject
@alihourag
@alihourag 10 ай бұрын
My G, God bless you
@emmannweb
@emmannweb 10 ай бұрын
Thank you so much bro!
@bitcoinizados4541
@bitcoinizados4541 Жыл бұрын
Hello, Very cool, what change would I have to make to upload multiple images?. Nice tutorial, thanks.
@emmannweb
@emmannweb Жыл бұрын
Your backend api that has the image field, you'll set it as array of ojects: [{}]; in your input file you'll add "multiple" as attribute. Your image state will be also array: const [images, setImages] = useState([]); const onChange = e => { const files = Array.from(e.target.files) files.forEach(file => { const reader = new FileReader(); reader.onloadend = () => { setImages(oldArray => [...oldArray, reader.result]) } reader.readAsDataURL(file) }) }
@emmannweb
@emmannweb Жыл бұрын
This video is the answer to your question: kzbin.info/www/bejne/fXaoYZ2Erahrfdk
@MatheusSilva-qm3ph
@MatheusSilva-qm3ph 4 ай бұрын
Very cool! One more subscribed.
@emmannweb
@emmannweb 4 ай бұрын
Awesome! Thank you.
@MrPindro
@MrPindro 9 ай бұрын
Well done chap, any chance of knowing how to upload an array of images into cloudinary and mongodb instead?
@emmannweb
@emmannweb 9 ай бұрын
Well, we already did a video about that: kzbin.info/www/bejne/fXaoYZ2Erahrfdk
@toyinatofarati5512
@toyinatofarati5512 3 ай бұрын
Great! did you experience and CORS error when you deployed this project?
@emmannweb
@emmannweb 3 ай бұрын
Not at all. Because i have added this line in package.json in frontend folder : "proxy":"host: YOUR_BACKEND_PORT". in localhost: "proxy": "localhost:8000" for ex. If 8000 is your backend port.
@toyinatofarati5512
@toyinatofarati5512 3 ай бұрын
@@emmannweb ok, I will do just that. I hope it will resolve the cors error I am getting from cloudinary. Thank you
@toyinatofarati5512
@toyinatofarati5512 3 ай бұрын
still experiencing the CORS error, although i am going through a different approach in uploading the files but it works on my local machine
@emmannweb
@emmannweb 3 ай бұрын
@@toyinatofarati5512 do you have cors package installed in backend and helmet? if so, in your backend server file, add: app.use( helmet.contentSecurityPolicy({ useDefaults: true, directives: { "img-src": ["'self'", "https: data:"] } }) ) for CORS: app.use(cors()); it should work, unless you missed something. Other consideration, if it works on localhost, you're almost there, in your package.json, "proxy": "localhost:BK_PORT", replace localhost by your server IP. and restart it again.
@toyinatofarati5512
@toyinatofarati5512 3 ай бұрын
@@emmannweb thank you for your time I will do as you have said, if it doesn't work out I might share my GitHub link
@stuartYoung559
@stuartYoung559 5 ай бұрын
HEY ! im uploading the image from my local files , and posting it using axios to cloudinary but im getting error like this: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. im worried that Cloudinary accept url of image , but when i console logged on image i got an alien huge massive data of leters. those are no way url to image
@emmannweb
@emmannweb 5 ай бұрын
Hi, In this tuto, the image is converted to Base64, cause Cloudinary support that format, maybe you missed something, the code is still working. I would suggest you to console.log what you'll send to backend and also console.log in backend what you received from frontend, so that you know exactly what's going on.
@stevemosi254
@stevemosi254 Жыл бұрын
This is amazing
@emmannweb
@emmannweb Жыл бұрын
Thank you so much!
@dannelmulja8958
@dannelmulja8958 Жыл бұрын
Hello sir, thank you for uploading this video,, it is very useful Although I encountered a problem In my post method, I used the same way as you did where I make a const result = await cloudinary.uploader.upload but it seems to not be working, because when I check my console it kept throwing to my catch error. I dont know why because I tried a lot of solutions but still it doesnt work Now my image base64 string does not include the data:image/jpeg;base64 but I tried adding them to my image string but it still does not work. Perhaps is there something wrong with my configuration or anything? Should the CLOUD_KEY and the other config variables have the " " as how we copied from the cloudinary? I really don't understand why my const result = await cloudinary.uploader.upload does not work, I tried to console.log under this function to check if it works but it does not output my log so I'm certain the problem is from that function please help thank you :)
@emmannweb
@emmannweb Жыл бұрын
Sorry for delay, you have few things to consider, when you're dealing with trouble first of all, is to download the code base to compare your code with,. Secondly it could be your configuration file with the values that come from .env file, recently i'm using the same code in this video lesson: kzbin.info/www/bejne/lXetfoWJoa2bbs0 it works really well. Other factor, in your package.json in frontend folder, you should add a "proxy": "localhost:8000", 8000 will represent your choosing backend port, if yours is 9000 you put it. Verify it in my cod base. There is no secret,i think you can do it.
@manukrishnan4318
@manukrishnan4318 8 ай бұрын
if i add more tan 100 pictures then it become slow ??? when storing imges in mongodb then it become very slow
@emmannweb
@emmannweb 8 ай бұрын
Well good question, i always advice that as developer we need to know all possibilities to upload images but also be able to make good choice is one of our job as developer. Sure, you would have a higher payload from the json reponse that could lead to a bad experience of the user.
@sutoraika6976
@sutoraika6976 Жыл бұрын
do you know how to automatically rename the file before upload? just asking.
@emmannweb
@emmannweb Жыл бұрын
I think it's possible but i didn't implement it yet. You'll need extra logic to name it randomly or with unique name and increment the value.
@user-dj8hh7ys2f
@user-dj8hh7ys2f 2 ай бұрын
Life Saver Dude
@emmannweb
@emmannweb 2 ай бұрын
You're welcome!
@malekguedda235
@malekguedda235 Жыл бұрын
so we don't need to use multer at all here ?
@emmannweb
@emmannweb Жыл бұрын
Exactly, we don't need to use multer in this case. If I would use multer, i won't use cloudinary vice-verca. Multer is very popular and it's known to save images locally. As i like more flexibility and portability, I opt for cloudinary.
@frandepaulo
@frandepaulo Жыл бұрын
Gracias!
@emmannweb
@emmannweb Жыл бұрын
De nada!
@luchoherrera8536
@luchoherrera8536 Жыл бұрын
i love you bro!
@emmannweb
@emmannweb Жыл бұрын
thank you, love you too bro
@codingmadeeasy3913
@codingmadeeasy3913 Жыл бұрын
How can I display images from a specific folder in cloudinary
@emmannweb
@emmannweb Жыл бұрын
To display images from a specific folder, as i understand your question, you should create your specific folder before, as i showed you in the video. Since you have pre-configured your specific folder in the backend API, you don't need to worry about them. It will display automacally, from that particular folder, once you make the API call.
@bappirahman3294
@bappirahman3294 Жыл бұрын
How to change temp files location? I'm using a serverless read-only server which allow write only one location. How can I set cloudinary to store on that location ? The default location isn't working
@emmannweb
@emmannweb Жыл бұрын
Could you be more specific, i mean with more details on the stacks you're using. However to find your implementation type and the way you should do it check this link: cloudinary.com/documentation/image_upload_api_reference#explicit, in that Doc you'll find implemenation for PHP, Ruby, Java etc.
@bappirahman3294
@bappirahman3294 Жыл бұрын
@@emmannweb I'm using node and cyclic.sh server when I get the image from frontend cloudinary create temp file in local environment before uploading to cloudinary storage. I want to change the location of that temp files
@emmannweb
@emmannweb Жыл бұрын
@@bappirahman3294 ok i get it, did you use other dependency like multer ? etc., in my opinion after the configuration of Cloudinary in the backend, it doesn't require a temp file (i think it's optional). The file name coming from the frontend to backend should exist exactly the same. Other consideration, before sending the image file with convert it to a string in base64, i-e if you can send your text fields in the backend from the frontend(you don't need extra configuration), it supposed to work, i think. All the data like text and image are sent to backend like string. I hope you get it!
@bappirahman3294
@bappirahman3294 Жыл бұрын
@@emmannweb I used multer but I removed it as a dependency and uninstalled it but still I'm getting write error
@emmannweb
@emmannweb Жыл бұрын
@@bappirahman3294 if your configuration is correct according to what we've showed in this video it should work. However, in your form before sending the data to the backend console.log them to check if all fields have a value same thing with the image field and verify its name front and back. 2) Probably if you're using Morgan package as middleware, check if your endpoint is reached 3) To enable image of a certain size to be uploaded, use this example : app.use(bodyParser.json({limit: '100mb'})); app.use(bodyParser.urlencoded({ // to support URL-encoded bodies limit: '100mb', extended: true }));
@hassanomar4950
@hassanomar4950 6 ай бұрын
Thnks Eng
@emmannweb
@emmannweb 6 ай бұрын
you're welcome!
@qamarzaman-qz
@qamarzaman-qz 10 ай бұрын
Can I do this in wordpress, is it possible if any one know themn please reply
@emmannweb
@emmannweb 10 ай бұрын
This implementation is for Nodejs App, but Cloudinary support many programming languages, check their documention. With Wordpress you can do it via plugin or custom code following their documention on that matter.
@qamarzaman-qz
@qamarzaman-qz 10 ай бұрын
@@emmannweb brother can you tell me?, which process is this called of upload my wordpress images to cloudinary Even from the frontend
@emmannweb
@emmannweb 10 ай бұрын
@@qamarzaman-qz cloudinary.com/documentation/wordpress_integration wordpress.org/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ I never used them but this should give you a starting point.
@jatinsaini2794
@jatinsaini2794 Жыл бұрын
I got an error Which says: MISSING REQUIRED PARAMETER - FILE PLEASE HELP ME❤️❤️
@emmannweb
@emmannweb Жыл бұрын
1) Seems like the image was not uploaded, check the image field name (front and back), 2) before sending the request, use console.log to check if you have all the fields value. 3) Compare the github project files, to verify what you miss.
@abhishaianandaraj.j6045
@abhishaianandaraj.j6045 Жыл бұрын
What do I do if I have a payload too large error?
@emmannweb
@emmannweb Жыл бұрын
good question. try to this snippet in your backend server API:app.use(bodyParser.json({limit: '100mb'})); app.use(bodyParser.urlencoded({ // to support URL-encoded bodies limit: '100mb', extended: true }));
@abhishaianandaraj.j6045
@abhishaianandaraj.j6045 Жыл бұрын
@@emmannweb I did that but still it's showing the same error
@emmannweb
@emmannweb Жыл бұрын
@@abhishaianandaraj.j6045 show your code
@abhishaianandaraj.j6045
@abhishaianandaraj.j6045 Жыл бұрын
@@emmannweb const app = express(); app.use(express.json()); app.use(bodyParser.json({limit:'100mb'})); app.use(bodyParser.urlencoded({extended:true,limit:'100mb'})); app.use(cors({ origin:"*", methods:["GET","POST","PUT"], "Content-Type":"application/json", }));
@abhishaianandaraj.j6045
@abhishaianandaraj.j6045 Жыл бұрын
if i post a large file(an image)it shows a cors error also. but for small files, it works normally
@theycallmejatin
@theycallmejatin 10 ай бұрын
How many years have you been learning to code ?
@emmannweb
@emmannweb 10 ай бұрын
About 7 years.
@theycallmejatin
@theycallmejatin 10 ай бұрын
@@emmannweb damn what's your age now
@user-ow7db4fe4q
@user-ow7db4fe4q 11 ай бұрын
You did not use multer?
@emmannweb
@emmannweb 11 ай бұрын
No, i'm not. It's not mandatory. But If you want to save your images in your project folder you could do so.
@user-ow7db4fe4q
@user-ow7db4fe4q 11 ай бұрын
@@emmannweb Ok.
@johnraphael7700
@johnraphael7700 Жыл бұрын
Please can I get the source code?
@emmannweb
@emmannweb Жыл бұрын
Github link: github.com/emmannweb/mernstackproject
@MoMoMOMO-pl9fj
@MoMoMOMO-pl9fj Жыл бұрын
where is the complet proj
@emmannweb
@emmannweb Жыл бұрын
This tuto was to show how to deal with images.
@suhailbhat9866
@suhailbhat9866 Жыл бұрын
Screen is not clearly visible
@emmannweb
@emmannweb Жыл бұрын
you could check you internet connection. i double check on my side, i saw it's fine.
@shurastun5530
@shurastun5530 Жыл бұрын
I found "OK" very irritating. Sorry. Like it was repeated for million times.
@emmannweb
@emmannweb Жыл бұрын
can you be more specific?
@shurastun5530
@shurastun5530 Жыл бұрын
@@emmannweb try to reduce your expression "OK" when talking.
@emmannweb
@emmannweb Жыл бұрын
​ @Shura Stun get it thank you.
@alexvolkov529
@alexvolkov529 Жыл бұрын
@@emmannweb and 'I mean' as well...
@emmannweb
@emmannweb Жыл бұрын
@@alexvolkov529 sorry guys, i'll try my best
@ernzotech
@ernzotech 6 күн бұрын
I am getting this error on POSTMAN "Unknown API key '777252576991944'," while trying to upload photo
@emmannweb
@emmannweb 6 күн бұрын
According to you error, seems like you have a problem with your Cloudinary credentails. Double check them. Don`t forget to put them with their correct name in .env file.
@ernzotech
@ernzotech 6 күн бұрын
I have done that correctly @@emmannweb
Cloudinary Image Upload with Nodejs and React
34:33
James Q Quick
Рет қаралды 69 М.
Upload image to cloudinary | Node.js Rest API with mongoDB in HINDI
14:59
SBS online classes
Рет қаралды 25 М.
FOOTBALL WITH PLAY BUTTONS ▶️ #roadto100m
00:29
Celine Dept
Рет қаралды 71 МЛН
Conforto para a barriga de grávida 🤔💡
00:10
Polar em português
Рет қаралды 105 МЛН
How To Load Images Like A Pro
15:48
Web Dev Simplified
Рет қаралды 352 М.
User Uploaded Images (Host For Free & Cloudinary Example Code)
20:06
Store Image in Base64 in MongoDB Using MERN Stack
22:35
Daily Tuition
Рет қаралды 53 М.
How To Preview Image and Upload To Cloudinary - React Tutorial
23:30
ZinoTrust Academy
Рет қаралды 3,7 М.
Speed Up Your React Apps With Code Splitting
16:50
Web Dev Simplified
Рет қаралды 364 М.