0

I have the typical form to register a record (VUE.JS).

One of its fields is an 'input type = file'.

I am able to upload a file, send it to the server (Java), and register it in the database (mongo) along with the rest of the fields.

The user can return to this same page, but in edit mode. (Do some changes and save it again..)

And this is where I have the problem: I am able to load the input file with the name of the file that I retrieve from the database (“fileName”). BUT not the binary data itself of the file (“fileData”).

The ‘data’ related to the file is available at this point in the frontend as this JSON object:

{
"fileName" : "DocPrueba (1).PDF",
"fileData" : "JVBERi0xLjcNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0N …. Omited  lots of chars like this…."
}
4
  • that looks a lot like base64 encoded data... could you elaborate - what is it you want to allow the user to do? Afaik you can't "edit" a file input element. and reattaching the file before the user looks at the page doesn't make sense. the only thing i can think of is allowing the user to download the file, and reupload, or displaying it's contents in some sort of frame...if it's always a pdf - maybe like an <embed> element - se stackoverflow.com/questions/17784037/…. Commented Nov 25, 2020 at 9:19
  • Its always pdf file stored as binary data, but not in base64 Commented Nov 25, 2020 at 9:55
  • 1
    This may help: stackoverflow.com/questions/41008024/… Commented Nov 25, 2020 at 14:16
  • I finally adopted another strategy based in some kind of ID's associatted to FILES that the app controls internally. Commented Nov 26, 2020 at 13:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.