![]() ![]() The cookie is used to store the user consent for the cookies in the category "Performance". This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. The cookies is used to store the user consent for the cookies in the category "Necessary". The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". The cookie is used to store the user consent for the cookies in the category "Analytics". These cookies ensure basic functionalities and security features of the website, anonymously. Necessary cookies are absolutely essential for the website to function properly. Current policies, offerings, procedures, and programs may differ. For purposes of simplicity, I’ve abstracted away the routing and controller functionality that calls the above method.ĭisclaimer: The information in this blog is current as of January 8, 2013. This is a great explanation of file permissions in Unix. Returning to the server, you can see that the permissions were appropriately modified, and the user can now download the Zip file of all the files for an assignment. The built-in site functionality works as well. By adding one line to our code, we modified our permissions and allowed the user to download the file appropriately. Much like you can run chmod in your bash window, Ruby also contains a chmod command. With a few modifications, we passed it an array of files, specified the file names, and created a file tree structure so that when the user downloaded the files, they were organized by submitter and named appropriately.Įverything worked on our local host, but when we deployed to our server we got an Nginx 403 permissions error. Once we SSH’ed into the server, we saw that the file was being created, but while the owner of the file was allowed to read and write the file, no one else could do anything with it. The RubyZip documentation is pretty dense, but thorough. ![]() If you’re writing a rails app, you don’t need to require ‘rubygems’, but you DO need to require ‘zip/zip’ in your application.rb file. For this, we implemented a gem called RubyZip. While an individual user would only upload one file to be associated with an assignment, the person who assigned the assignment would probably want a way to download all of the submitted work at once. Both will walk you through the steps of setting it up, and it took us about 20 minutes.įile download was a bit more complex. The Github page has a pretty thorough walk-through, but if you’re looking to display the content on your website there is a Railscast on the file upload process. The basic upload functionality was surprisingly easy to implement using a gem called CarrierWave. Once the basic functionality of our assignment.io website was implemented, one of the features that we wanted to implement was file upload and download. Corinna is currently a student a The Flatiron School. The following is a guest post by Corinna Brock and originally appeared on her blog.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |