Bro you specify contentType : image/png but you upload jpeg image and it accepts it. So how we validate the uploaded image is only in particular format
my backend is working perfectly but i got this error in frontend ERROR Maximum call stack size exceeded RangeError: Maximum call stack size exceeded please help i have written exactly as you have written
I have uploaded images using both multer and base64 into the same mongoDB schema. Now I want my webpage to render both images simultaneously. Is it possible? By the way, I have not watch this video yet. just curious.
Just for anyone wondering, this will likely not work in prod since most people are hosting on a cloud server with a cloud database. That just means that if this isn't running on your own server or a cloud DB, you're going to lose the data that was saved ultimately.
Okay hold on a minute. Lovely video. Simple and Straight forward Saved me a lot of time reading the nodemailer documentation. But Am I the only one thinking the mail shouldn't have worked?? In the details object the mail written in the "from:" is spelt wrong actually. Does that mean It has no effect whatsoever as long as the the mail written in the mailTransporter object is correct??
I don't recommend this video however it is working. it is because it is taking disk space and both database space. What's point of storing the image in the folder if you are not using it to send back (you are still getting data back from database which is really slow even with only 1 image). It would be good if we used the image stored in folder to sent back and not use the buffer stored in database which would speed up the fetching into server from database.
For anyone wondering how to post with React, you first have to make a new FormData( ) variable and then append the name and image file to it. Then do the usual fetch with method: POST and the body being simply your new form data. Nothing else needed. Don't include a header unless you really need to, it won't work with this example and DO NOT stringify your body. And if you wanna upload straight to the database without storing on disk, do this: Change const storage to multer.memoryStorage( ). Then under data, put req.file.buffer. That is all. And to increase the file size, use these settings in your app.js: app.use(express.json({ limit: "50mb" })); app.use( express.urlencoded({ extended: false, limit: "50mb", parameterLimit: 10000 }) ); It doesn't have to be 50mb, and don't set it too high if you're sharing you app with strangers. They can do some malicous stuff with this lmao. Hope this helped someone
getting this error when trying to install npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: react-rails-api-project-template-client@0.1.0 npm ERR! Found: react@17.0.2 npm ERR! node_modules/react npm ERR! react@"^17.0.2" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"~0.14.8 || ^15.0.0 || ^16.0.0" from google-maps-react@2.0.6 npm ERR! node_modules/google-maps-react npm ERR! google-maps-react@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR!
To help keep your account secure, from May 30, 2022, Google no longer supports the use of third-party apps or devices which ask you to sign in to your Google Account using only your username and password.
hello i am getting an error at req.file.filename TypeError: Cannot read properties of undefined (reading 'filename') and I have also double checked name at both sides .
try using const multer = require('multer'); const storage = multer.diskStorage({ destination: function (req, file, cb) { cb(null, 'uploads/'); }, filename: function (req, file, cb) { const ext = path.extname(file.originalname); const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1e9); const fileName = file.fieldname + '-' + uniqueSuffix + ext; req.fileName = fileName; // Save the generated filename in the request object cb(null, fileName); }, const upload = multer({ storage: storage }); after u write ur post/get line add this before ur query (for example) before the query! const petPic_link = req.fileName i had the same issue & it was fixed
bro nice class how to add name with the image u miss that .can you do the name also with the image to Frontend.Plz do that i am struck at there sir.From days onwards