Upload video with multer and cloudinary - can't read req.file

RomanDev
RomanDev Member Posts: 1
edited September 2022 in Developer APIs

In my Mern-Stack I have build a fileuploader using multer and cloudinary. The upload of images works really fine, but when I try to upload a video, the console tells me: "Cannot read property "path" of undefined". I console.log my FormData on the whole way. In my dashboard, my redux-slice, my redux-service. Everywhere the value “src” is a file. So there must be a discord between multer and cloudinary. I am new in this group. So I don't know how to insert code in my post. Because of that I give this link: javascript - Upload video with multer and cloudinary - can't read req.file - Stack Overflow

Can someone help me out? Thanks

Tagged:

Answers

  • Ranson
    Ranson Cloudinary Staff Posts: 16

    Hey Roman,

    I think the first thing you'll need to do here is to log the response from the upload call. So we can figure out exactly where/what the error message you are receiving is. If you are able to produce a working codesandbox of your app ( with redacted API key/secret ) this would also assist us with debugging.

    I see you are utilizing the upload_large method and wanted to make sure that you are utilizing the Node JS SDK and not just calling the Cloudinary API?

    Checking the docs for upload_large indicates that it requires SDK usage and will be chunking the upload.

    https://cloudinary.com/documentation/upload_images#chunked_asset_upload

    Multer does appear to be able to support chunk uploading per this thread: https://stackoverflow.com/questions/54541579/how-to-combine-video-upload-chunks-node-js

    We will be able to offer more advice once the specific error message is logged though ( either from the Cloudinary servers or from the application before the upload request ) , so let us know what you find.