You can set a download directory and before download, delete and create it.
Now download and use directory file path with random file.
If file exists, continue, else, still wait.
Remember to check if downloaded file is a temp file or complete download, you can do it using a wildcard.