Question

Does Paperclip scans the files for errors, malicious software, viruses before uploading to database? If no, what are the viable solutions.

And, is it better to first create a separate folder for each user before they upload files and store in their respective folders? What are the merits and demerits of it? Is it possible to specify this with Paperclip?

Thanks

Was it helpful?

Solution

Re viruses etc, this might be useful - Rails / Heroku - How to anti-virus scan uploaded file?

Re storing each user's files in a seperate folder: the conventional way would be to store every FILE in a separate folder, and then link the files to the user via the database (eg a user_id field on the file records). As far as merits and demerits go, besides it not being conventional, one thing to bear in mind would be that if a user's files are stored in a single folder, then if they upload a two files with the same name then the second would overwrite the first (unless of course you put them in separate folders within the user's folder). This could be a good thing or bad thing depending on your requirements.

BTW - a slightly pedantic note: files aren't uploaded to the database (at least not normally) - they are uploaded to a filesystem, and a corresponding record is created in the database. The files don't go into the database (as i say, usually: it is possible to store files as blobs in the DB but it's not good practise and not usual).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top