For this example, we shall be using the following website opened in Firefox:

This contains the following file upload box:

Which is created from the following HTML:

<form action="myform.cgi">
<input type="file" name="fileupload" value="fileupload" id="fileupload">
<label for="fileupload"> Select a file to upload</label>

To record this script in Rapise, simply use the LEARN (Ctrl+2) function to learn the Browse... and SUBMIT buttons above. You can then write the following code in Rapise to automate the upload:

//Click the upload 'Browse'	

//Send the filename and enter
Global.DoSendKeys('C:\\temp\\small text file.txt');

// Click Submit button

The object Select_a_file_to_upload should be replaced with the object that you learned from your application.

Note: We need to use the DoLClick() function rather than the normal DoClick() function since we need to simulate a real user's left-click and not trigger the browser event directly as otherwise the browser security will prevent the enter of the filename.

Attached to this sample is a copy of a complete working sample.

In RVL, the script from the example would look as follows: