Skip to content
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

Adding Multer Middleware and Cloudinary Utility #28

Closed
wants to merge 4 commits into from

Conversation

MOHINI1403
Copy link

@MOHINI1403 MOHINI1403 commented Oct 6, 2024

Description :

In response to the issue assigned for adding the multer middleware and writing the cloudinary utility I have attached the code . Issue No : #19
Important Points

Addition of the Multer Middleware

  1. This contains the code mentioning how the directory created for local storage of the uploaded files giving them unique name via const uniqueSuffix=Date.now()+"-"+Math.round(Math.random()*1e9);
  2. Configuring diskStorage() which is used to handle file uploads in Node.js.
  3. Each uploaded file will have a unique filename based on the form field name and a combination of the current timestamp and a random number. This prevents overwriting files with the same name.

Addition of the Cloudinary Utility

  1. A utility function that uploads files on Cloudinary from local storage and and removing them from the local file system after a successful upload.
  2. Cloudinary Configuration : You need to make an account on cloudinary
    image
    From here you are create a new key : Remember the cloudinary_cloud_name : Product Environment:
  3. After this a function that uploads the files on cloudinary and then returns the cloudinary url which could be stored in DB

I am contributing this under GSsOC-Ext . Please consider the PR .

@sudo-dpkg
Copy link
Owner

@MOHINI1403
Please resolve the merge conflicts and thoroughly test your changes before submitting a pull request.

@MOHINI1403
Copy link
Author

done

@sudo-dpkg sudo-dpkg closed this Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants