This small Studio Web tutorial will teach you how to download a file from a website and do some things with it - in this case, upload it to a OneDrive folder.
While the experience of downloading the files will be improved with the introduction of dedicated activities, this small tutorial will teach you how to do that in the meantime.
The end result:
To start, we will open a webpage that contains a clickable link to our file. In our case, we will make use of this sample page:
Next step is to click on the link to download the file
A simple delay to make sure the file is downloaded.
For more advanced users, this can be replaced with a Do While loop that will periodically check if the file is already there, rather than using a fixed delay.
But for this example we will keep it simple.
The activity Path exists allows you to input any local file path and create a file variable out of it when it exists. Otherwise, it would be difficult to upload your file in the next step.
The expression to fetch the file is slightly long, but this will also be improved in the future
Directory.GetFileSystemEntries((Directory.GetDirectoryRoot(Directory.GetCurrentDirectory)+"tmp/home/Downloads"), "*.txt", SearchOption.AllDirectories)(0)
Please make sure to insert this code snippet with the Open Expression Editor:
The last step is quite simple. We take the output of the Path Exists activity and we provide it to the Upload file to OneDrive activity. And after setting up the connection and the target folder, we’re done!
Feel free to import the project and give it a go
Download a file from the internet and upload it to Cloud.uip (28.2 KB)