Release Notes
Announcements
condition: {// Uploaded files must be less than 5MB'numeric_less_than_equal': {'cos:content-length': 5 * 1024 * 1024},}
var policy = JSON.stringify({...conditions: [['content-length-range', 1, 5 * 1024 * 1024], // Limit file size range such as 1 - 5MB],});
condition: {// Uploaded files must be image type'string_like': {'cos:content-type': 'image/*'}}
var policy = JSON.stringify({...conditions: [// Limit uploading file content-type must be image type['starts-with', '$Content-Type', 'image/*'],],});
/** Server-side generation upload path example nodejs **/// Get the file extension ext passed from the frontendconst ext = req.query.ext;const cosKey = generateCosKey(ext);function generateCosKey(ext) {const date = new Date();const m = date.getMonth() + 1;const ymd = `${date.getFullYear()}${m < 10 ? `0${m}` : m}${date.getDate()}`;const r = ('000000' + Math.random() * 1000000).slice(-6);const cosKey = `file/${ymd}/${ymd}_${r}${ext ? `.${ext}` : ''}`;return cosKey;};

Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan