-
Notifications
You must be signed in to change notification settings - Fork 4
API
Dewangga edited this page Apr 26, 2023
·
24 revisions
Tentu saja, berikut adalah dokumentasi menggunakan syntax Markdown GitHub:
Endpoint ini digunakan untuk mengunggah foto profil pengguna.
-
URL
/upload
-
Method
POST
-
Request Headers
Tidak diperlukan
-
Request Body
Field Type Description file form-data File gambar untuk diunggah -
Request Query Parameters
Parameter Type Description mode string Mode pengunggahan gambar (square, landscape, portrait) -
Response
HTTP Code Type Description 200 object Berhasil mengunggah gambar 400 object Gagal mengunggah gambar -
Sample Call
[HttpPost("upload")] public async Task<ActionResult<PhotoResponder>> PostPhotoProfile([FromForm] PhotoUploadModel file, [FromQuery][BindRequired] string mode) { if (file == null || file.File == null || file.File.Length == 0) return BadRequest(CreateResponse(400, "Please Proveide Photo Image")); using Stream fileStream = file.File.OpenReadStream(); var result = await Mediator.Send(new Upload.Command { File = fileStream, FileName = file.File.Name, Param = mode }); return GetResult(result); }
Check Other Page :)