Managing large file uploads - best practice?

Hello everyone,

I’ve got an app where I need to give the user the facility to upload a
large-ish (up to maybe 10Mb) CSV file. I really don’t want to have to
deal with idiots uploading porn, /dev/zero, and whatever else they
feel I might appreciate - I want to eliminate everything that isn’t a
valid CSV file as quickly as possible in the upload process.
It’ll have a reasonably simple login/password mechanism, but it’s not
100% clear at this point whether I’ll have to have a “guest”-type user
capability, and thus be potentially leaving the front door to the
asylum ajar…

Is there any existing best-practice type information around for how to
police this? I want to ensure that files being uploaded are valid CSV
files, that they contain a specific number of fields and aren’t too
large.

I can think of a few ways of doing it; none strike me as particularly
elegant, particularly when it comes to chopping off any offending file
uploads mid stream.

Thanks in advance for any suggestions

Dave M.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs