I must start by apologizing for my English, as I am not the most fluent speaker.
Here's where I'm facing a dilemma:
I have created an application that allows users to edit questions for a game. These questions are stored on a server and can be downloaded for offline editing. Once editing is complete, the modified question is uploaded back onto the server. These questions also include images. To address this, I created a simple form that saves the image as a FormData object into another Object.
Let me walk you through how I accomplish this:
var formDataTemp = new FormData();
var qcid = // unique Id
if($('#editImageFileInput')[0].files[0] != undefined) {
formDataTemp.append("img", $('#editImageFileInput')[0].files[0]);
questionImageCache.push({
qcid: qcid, img: formDataTemp
});
}
I've omitted some of the additional data in the object for clarity.
There's also a list containing all the questions the user has previously downloaded, allowing them to navigate between different questions.
Now, I'd like to display the saved image when the specific question is revisited. Is there a way to achieve this without having to re-upload the image? Can the image be displayed directly from the JavaScript object?