I can't seem to find a simple and clear answer to this problem anywhere! Everything seems either outdated or incomplete! I just want the user to be able to click on a link or button and download a file that is somewhere in the public folder.
This opens up a massive security hole, allowing a user to access any file that is readable by your application namely, your entire application, but also possibly other files on the filesystem.
Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. How to download a file from rails application Ask Question. Asked 10 years, 5 months ago. Active 8 years ago.
Viewed 25k times. Richard This seems like a terribly unsafe way to handle this, especially considering you can just link directly to the file.
Andrew - use what? Someone could edit your link like this:? I would be more than happy to hear of the "correct way" for a user to obtain a file!!! Open to any suggestions! Show 3 more comments. Active Oldest Votes. Rather, if the file is under public, link to the file itself. Mario Mario 2, 1 1 gold badge 22 22 silver badges 37 37 bronze badges. Won't the download lockup the rails process?
Shouldn't the download instead be handled by the http server apache, etc. If you set up apache or another server, it should handle that. Notes: Blocking apps could make them unstable. Need more help? Join the discussion. Was this information helpful? Yes No. Thank you! Any more feedback? The more you tell us the more we can help. Can you help us improve? Resolved my issue. Clear instructions.
Easy to follow. No jargon. Pictures helped. Didn't match my screen. Incorrect instructions. Too technical. Not enough information.
0コメント