Getting File Content from Uploaded Documents
Question

I am trying to figure out this assignment, I am currently having hard time extracting file content from uploaded file. How should I approach to this problem?


Create an app that allows the user to upload documents and images not more than 5MB. If the file is not the correct size or file type, the app should show an error saying why the file is not permitted to be uploaded. Each user should only be able to upload a max total of 25mb,. if the current file being uploaded will reach the max total, then the user should be shown an error message. The user should be able to view a list of all files successfully uploaded with File name, file type, file size and date uploaded information., this list page should also contain the total file size already uploaded by this user

There will be a separate list page for app admin who will be able to view all the files uploaded by all the users. The list should contain file name, file type, file size, username who uploaded, upload date. The page will also show the total size of all the files uploaded by all users. When the admin clicks the username in the list, it should show the list page that the users see when they are viewing their own files. 

mvp_badge
MVP

Hi Tuguldur,

First, it would help if you state in your original post which type of application (traditional, reactive, mobile) you are making. When creating a question on the forum, you can select one or more application types. This will help solutions provided by other community members, as they depend on the type of application.

Second, what did you try already yourself? Did you already break down these requirements in roles, screens, did you look already at widgets you might use? Did you already search the forum if a similar question has is asked in the past that might already have a solution described?

Regards,

Daniel

Hi Daneil,

Thank you for your informative suggestions, as I am new with the Outsystems I was not aware of all of these things. To answer your question; 

1) I am doing Traditional Web application. 

2) I have created table where user can see all the file information as well as upload file section where user can choose which file to choose from from their computer. Through upload widget I was able to get the file name and also fill out date created attribute when the user uploads file. I am having trouble with figuring out how to get the File type.



mvp_badge
MVP

Hi Tuguldur,

I fully support Daniel's answer. This post lacks some information, and parts of this question have already been answered in the forum. Always search the forum before asking a question.

That being said the BinaryData_API should get you well on your way. Please have a look here:
https://success.outsystems.com/Documentation/11/Reference/OutSystems_APIs/BinaryData_API

What would be the best approach to you track each user being only able to upload no more than 25MB size file?

FileUploadApp.oml

mvp_badge
MVP

Using the binary data api I mentioned above you can keep track of the file size of each file uploaded by the user. 

You can then check with an aggregate what the total is. 

I am already using the binary data api you mentioned above, when I use aggregate to get the total I am having error on assignment "invalid element expression". Maybe my logic is flawed. Could you take a look at my OML file? @Eric Bulters  thank you

FileUploadApp.oml

mvp_badge
MVP

Hi Tuguldur ,

I am not sure where you are getting your error.
But I changed some things:
- you had a FileList entity that did nothing? (it was not being filled and even so it was related to 1 upload so didn't make sense) so I removed it
- I added a userId to your upload so you can track the total uploaded size per user
- I added an aggregate that sums the total of sizes of all files uploaded by a user.

FileUploadApp.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.