릴리스 노트
제품 공지
condition: {// 업로드 파일은 최대 5MB로 제한됨'numeric_less_than_equal': {'cos:content-length': 5 * 1024 * 1024},}
var policy = JSON.stringify({...conditions: [['content-length-range', 1, 5 * 1024 * 1024], // 업로드 파일 크기 범위 제한 가능(예: 1 - 5MB)],});
condition: {// 업로드 파일의 content-type이 이미지 유형이어야 함'string_like': {'cos:content-type': 'image/*'}}
var policy = JSON.stringify({...conditions: [// 업로드 파일의 content-type이 이미지 유형이어야 함['starts-with', '$Content-Type', 'image/*'],],});
/** 서버에서 업로드 경로 생성 예시 nodejs **/// 클라이언트에서 전달된 파일 확장자 ext 획득const 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;};

피드백