Restore file name and base64 encoding extension


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?


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.

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.