download error if file exists
See original GitHub issue/**
* Create a file using java.io API
*/
private File createFileInAppSpecificDir(String filename, String savedDir) {
File newFile = new File(savedDir, filename);
try {
boolean rs = newFile.createNewFile();
if (rs) {
return newFile;
} else {
logError("It looks like you are trying to save file in public storage but not setting 'saveInPublicStorage' to 'true'");
}
} catch (IOException e) {
e.printStackTrace();
logError("Create a file using java.io API failed ");
}
return null;
}
should add this
if (newFile.exists()) {
return newFile;
}
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:9
Top Results From Across the Web
Download and check if file exists - python
I'm not sure how to grab and check the url filename. 1 - open a text file containing a list with URLs (example.com/file.exe, ......
Read more >How to check if a file exists (in download folder) from your App?
In this video it shows how one can check whether a file exists or not for Android 11 (API level 30) and above...
Read more >Powershell If file exists, do nothing , else, download
If the file exists, the download should not even run, which means that the check is failing. What do you get if you...
Read more >File Manager check if file exists before download
Implement your own logic to check if a downloaded file exists and cancel a current download operation with the corresponding error text.
Read more >Fix file download errors - Google Chrome Help
Get help with a specific error message · Cancel the download and try again. · Instead of clicking the file to download, right-click...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This error is also happening on Android when the file is in the directory but I’m trying to download it using the downloader.
@hnvn do you think there’s a better solution for this? I think it’s better to append a duplication number to the file name
ex(photo.png, photo(1).png)
since different files can have the same file name and rewriting or retrieving the file with the same name isn’t the best solution IMO. I can work on a PR for this fix, I just need your input. 😃you all have this open failed: EACCES (Permission denied) error? I’m not sure that I have the same issue as you but it seems like that