Use the Upload widget to add files - such as photos - to your application.
To upload a file in a mobile app:
- Drag the Upload widget from the Widgets toolbar to the screen.
- On the screen, create a local variable of Binary Data type to hold the file content.
- Set the File Content property of the Upload widget to the local variable.
- Use a Client Action to call a Server Action to send the file to the server:
- Change the Server Action to accept the variable in the File Content property as an input parameter and save it.
- In the Client Action, add the variable as an argument to the Server Action.
To upload a file in a web application:
- Drag the Upload widget from the Widgets toolbar to your screen.
- Add a Button to the screen that executes a Screen Action to save the file and make sure its Method property is set to Submit.
- To save the file in the Screen Action, use the Runtime Properties of the Upload widget:
- Upload.Content: the file content
- Upload.Filename: the file name
- Upload.Type: the file type
- In the screen you want to upload the file, create a link to navigate to the newly created screen containing the Upload widget. Alternatively, you can put the screen with the Upload widget inside a popup.