As long as [app_root]/public/download/latest.rar exists and is readable, that should work. Have you confirmed that the filesystem permissions on the stored file allow it to be downloaded? Maybe try with another type of binary file, just to rule out any issues your environment might have with serving up .rar files specifically. Are you proxying requests through a web server (e.g. nginx)?
@hwillson have any example ? i use nginx but dont know how to do that
i dont know how to confirmed that the filesystem permissions on the stored file too @@
please help !
Okay - backing up a bit then; how are you deploying your application (using mup for example) and where are you hosting it (Galaxy, Heroku, AWS, DigitalOcen, etc.)?
To check permissions, SSH into your Ubuntu box. Find the location of your deployed app bundle, then take a look inside the public assets directory. In your case it will be something like:
cd [some_parent_dir]/programs/web.browser/app/download
Within that directory, list the file permissions using ls -l:
[server] /opt/testapp/app/programs/web.browser/app/download > ls -l
total 0
-r-xr-xr-x 1 meteoruser root 0 Apr 20 09:20 latest.rar
You just want to make sure your deployed downloadable files are set to be readable by whoever your web service is running as. In the above case for example the listed file is readable by everyone (take a look at Understanding Linux File Permissions if you need more info).
If that all looks okay, then something else is corrupting the download. Have you tried adding another type of binary file into your app for download, like an image or a PDF? If you can download other types of binary files than .rar files, then you might have a content-type issue with your web server. You might need to look into adjusting your mime types via nginx for example.
Did someone solve this? I am having the exact same issue!
Running on local host, I have my files in the public folder and made them chmod 777 so that Iām sure it is not an issue of permissions. Still, no matter what the file format is, they get corrupted when trying to download them.
this resolve, we sould use .zip file replace for .rar.
other way, i create subdomain: public.domain.com and config public download files with nginx.
thanks so much !
this resolved !