"how to upload document cloddinary" Code Answer's

You're definitely familiar with the best coding language TypeScript that developers use to develop their projects and they get all their queries like "how to upload document cloddinary" answered properly. Developers are finding an appropriate answer about how to upload document cloddinary related to the TypeScript coding language. By visiting this online portal developers get answers concerning TypeScript codes question like how to upload document cloddinary. Enter your desired code related query in the search bar and get every piece of information about TypeScript code related question on how to upload document cloddinary. 

how to upload document cloddinary

By Restu Wahyu SaputraRestu Wahyu Saputra on Feb 25, 2021
// util.cloud.ts
import { v2 as cloudinary } from 'cloudinary'

export const cloudStorage = (filename: string): Promise<Record<string, any>> => {
	return new Promise((resolve, reject) => {
		cloudinary.config({
			cloud_name: process.env.CLOUDINARY_NAME,
			api_key: process.env.CLOUDINARY_API_KEY,
			api_secret: process.env.CLOUDINARY_API_SECRET,
			shorten: true,
			secure: true,
			ssl_detected: true
		})

		cloudinary.uploader
			.upload(filename, { resource_type: 'auto' })
			.then((response: UploadApiResponse) => resolve(response))
			.catch((error) => reject(error))
	})
}

// upload.ts
const urls = []
	const image = req.files.image
	const document = req.files.document
	const files = image.concat(document)

	for (let file of files) {
		try {
			const response = await cloudStorage(file.path)
			urls.push(response)
		} catch (err) {
			console.log(err)
		}
	}

Add Comment

0

how to upload document cloddinary

By Restu Wahyu SaputraRestu Wahyu Saputra on Feb 25, 2021
resource_type = auto
please check more about options this -> https://cloudinary.com/documentation/image_upload_api_reference

Add Comment

0

All those coders who are working on the TypeScript based application and are stuck on how to upload document cloddinary can get a collection of related answers to their query. Programmers need to enter their query on how to upload document cloddinary related to TypeScript code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about how to upload document cloddinary for the programmers working on TypeScript code while coding their module. Coders are also allowed to rectify already present answers of how to upload document cloddinary while working on the TypeScript language code. Developers can add up suggestions if they deem fit any other answer relating to "how to upload document cloddinary". Visit this developer's friendly online web community, CodeProZone, and get your queries like how to upload document cloddinary resolved professionally and stay updated to the latest TypeScript updates. 

TypeScript answers related to "how to upload document cloddinary"

View All TypeScript queries

TypeScript queries related to "how to upload document cloddinary"

Browse Other Code Languages

CodeProZone