React image and video upload
When using the React SDK, you can use one of several options to upload files directly to Cloudinary without the need for server-side operations or authentication signatures.
Upload options
Upload widget: A ready-made, responsive user interface that enables your users to upload files from a variety of sources directly to Cloudinary. This UI can be easily customized and embedded within your web application with just a few lines of code.
Upload endpoint:
https://api.cloudinary.com/v1_1/${cloudName}/upload
. To use the endpoint in your application, write a function that calls the Cloudinaryupload
endpoint and pass:- an unsigned upload preset with the upload method options you want to apply for all files
- the file(s) to upload
- other unsigned upload parameters to apply to the selected files (e.g.
tags
, if needed)
jQuery SDK with Blueimp File Upload adapter: If you are using jQuery in your app, you can take advantage of the built-in upload functionality in Cloudinary's jQuery SDK. This solution uses modern HTML5 cross-origin resource sharing (CORS) and gracefully degrades to a seamless iframe based solution for older browsers.
Code examples
- Code sample: Implement the upload widget.
- CodePen: Upload multiple files using a form in pure JavaScript using the Cloudinary upload endpoint.
- CodePen: Use XMLHttpRequest to upload files in pure JavaScript using the Cloudinary upload endpoint for unsigned uploading with an upload preset.
- Video tutorial: Generate an authentication signature on the server for a signed upload from the client side.
- Git sample project: Upload files and use a React upload control in the Photo Album sample project.