POST /api/things/file/
- 파일 업로드
- 권한: 승인된 사용자
- parameters
key |
type |
default |
required |
description |
id |
pk |
|
|
File id |
file |
File |
|
True |
첨부할 파일 |
filename |
char(128) |
|
|
파일명 |
content_type |
char(150) |
|
|
파일 종류 |
size |
BigInt |
|
|
파일 크기 (Byte) |
- filename
- 파일 업로드 시 고유한 파일명을 생성하고 해당 파일에 대한 Random access를 방지하기 위해 실제 파일에는 random string이 붙음
- 즉 사용자가 업로드한 파일이 rocat.png 라면 실제로는 rocat_o4Ae4rz.png 와 같은 형태로 저장됨
- 사용자가 업로드한 파일명을 화면에 보여줄 때 이처럼 랜덤 파일명이 붙으면 보기 좋지 않으니 원래 파일명을 보여줄 수 있도록 하기 위한 필드
- <a href=”file.file”>file.filename</a> 와 같이 쓰면 됨
- input sample

{
"data": {
"id": 1,
"file": "<http://localhost:8000/upload/files/rocat_o4Ae5rZ.png>",
"filename": "rocat.png",
"content_type": "image/png",
"size": 54335
}
}
DELETE /api/things/file/{file_id}/
- 파일 삭제
- 권한: 관리자
- parameters: 상동
- input sample
- DELETE /api/things/file/1/
- output sample