Information
Upload an image file to a remote server or cloud storage.
Usage
Basic API information
Method: POST
API Base URL: https:
Parameters:
- imageFile: Image file to be uploaded
Example
Each code snippet provides a clear and concise illustration of making API requests, with comments explaining the purpose of each request and any required parameters. By following these examples, you can seamlessly integrate Cortado.js into your web applications and leverage its powerful features to enhance image optimization, PDF processing, and more.
import axios from 'axios';
const uploadImage = async (imageFile) => {
try {
const formData = new FormData();
formData.append('imageFile', imageFile);
const response = await axios.post('/api/upload', formData, {
headers: { 'Content-Type': 'multipart/form-data' }
});
console.log('Uploaded image URL:', response.data.uploadedImageUrl);
} catch (error) {
console.error('Error uploading image:', error);
}
};
uploadImage(imageFile);