Is there a way to keep the file inside the upload widget after uploading it?

Hello, I was wondering if we can keep the file (or at least the name of the file) inside the upload widget after uploading. So, whenever I put a file into the upload widget, the name of the file will disappear from the widget after I upload that file. But I’d like to keep that file stored inside the widget even after I upload the file. Is there any way that I can get the upload widget to keep the specified file within itself after the screen is refreshed after a file is uploaded?

Hi Aqsha!

To better answer the question, it would be helpful to better understand the underlying rquirement. Is the idea to have a function to replace the file wit a new one, block upload of additional files or just show what file was uploaded? "Keeping" the file in the widget might not be the best way to achieve any of those goals. Why not store the file on the DB and then have a section under the upload widget showing the file information. Depending on what you want to achieve, you can either:

- Hide the upload widget if a file already exists in order to block further uploads, perhaps with an option to delete the file and replace it

- Show the upload widget and apply whatever logic you wish to any additionally uploaded file (add to list of files or replace existing file)

I think such an option would make it more clear to the user that a file has been uploaded and allow him/her to take action based on this knowledge. If the file name remains in the upload widget it is not clear if the file was uploaded or just selected and waiting to be submitted.

I hope this answers your question. 

Good luck with your project!

Solution

Hi Aqsha,

I don't think that's possible. That has not much to do with OutSystems, as it is the way browsers handle the upload widget.

Solution

Thank you Mattias for your response and feedback. I understand that the idea seems so far-fetched. I implemented a preview feature which ended up refreshes the screen, display the uploaded picture and also display the name of the file uploaded in an expression. However, it just feel out of place to see the text "No file chosen" inside the upload widget, since you cannot store the name value.


Thank you as well Kilian for your response. I realized now that it is not possible to do so.