The image communication is not organized, so please.

Asked 2 years ago, Updated 2 years ago, 27 views

Hi, everyone. In HTTP-based communication, I only vaguely know that when I communicate with images, I go through a Base64 encoding/decoding process. I asked before and they said they'd save it as a file on the server.

Come to think of it, (Transmission Process) At the client end, base64 encoding -> transfer to server -> Save the Base64 encoded string as a file using the file input/output API on the server At this time, for security purposes, several types of extensions are arbitrarily promised and mixed.

(Receipt process Find the image file on the server end and convert the file into a string using the file input/output API -> Send it to the client end via HTTP communication -> Perform Base64 decoding on the client end

Is this okay? And can I just shove the small size image into the DB row? Lastly, if you go through the Base64 encoding process, the image of 500KB tall will increase by more than four times to about 2MB, so do you accept this?

Thank you.

android

2022-09-22 21:57

1 Answers

When uploading/downloading binary files, such as images, you can resolve them without using base64.

When send client (upload request), the request format should be multipart (link 1:RFC1341, link 2:RFC2388.

In this case, the size of the data being transferred is the file's circular + HTTP header (overhead), and if the file is too small, the overhead may feel quite large.

반대로, 클라이언트 수신(다운로드)시에는 Content-Type의 mime-type의 앞부분 (xxx/yyy에서 xxx, 예: text/plain, image/jpeg...)만 정확히 구분해준다면, Base64 인코딩 없이 데이터를 전송할 수 있습니다.

Of course, in both cases, this is only possible if the HTTP protocol specification is well followed between the server and the client.

Save data is usually because file on a server has more performance advantages than storing it in a DB. Technically, it doesn't matter if you store it in DB. If there's a reason why you have to save it in the DB, you can do that.


2022-09-22 21:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.