Restore filename and extension from base64 encoding

13,630

If the filename/extension are not included within the base64 encoded string (for example in the message) I don't think there is a way to restore it, (can be context depending). Using another encoding type won't change that; e.g. the client has to specify the filename/extension and include it in the request (either as parameter or within the encoded content) before the server can use it.

Share:
13,630
user2281439
Author by

user2281439

Updated on June 14, 2022

Comments

  • user2281439
    user2281439 almost 2 years

    I need write server side part to post a forum reply. I receive a post request with reply text, and attachment which is a base64 encoded string. Is there a way to restore filename and extension from this base64 string, or I need to have them as additional params in request? Is it a right way to post attachment as as base64 string?

    EDIT

    It's a spring web service, I'm expecting Post request. For now I'm using x-www-form-urlencoded encoding and expect message and encoded file to be a part of form body. But encoding type can be changed if needed. On server side I just retrieve it as requestParams map, and extract encoded String from this map.