team-formalist / formalist-rb

Flexible form builder
MIT License
22 stars 4 forks source link

Add the ability to set a 'response-content-disposition' param/header when uploading a file #82

Open dylanwolff opened 5 years ago

dylanwolff commented 5 years ago

Per a client request (see: https://3.basecamp.com/3810878/buckets/9505978/todos/1362900706) it would be useful to be able to set a response-content-disposition param when uploading a file via an upload field, as a means of controlling whether the file is rendered inline or as an attachment when a user clicks a link to access it (by setting the Content-Disposition header appropriately for the file on S3).

See also some internal discussion here: https://icelab.slack.com/archives/C2BT34RK7/p1541993717013500

makenosound commented 5 years ago

So the use case here is that:

We want to change the content-disposition we set? There are a few different ways we could handle, so just want to check that both those statements above are true or not. Think we could potentially make it:

dylanwolff commented 5 years ago

I mentioned to the client that we could do this either at a global level for particular types of files (which I thought might be the simpler option) or potentially also on a per-upload-context basis.

The client's response was:

Thanks for that information - I think if we could define it just for PDF's (which will be the most used file) that would be great

So if the global configuration option is going to be much simpler to implement perhaps that will suffice for now? We could potentially then add the ability to set this at the field level at a later date.

makenosound commented 5 years ago

Yeah, we could perhaps make it a tiered thing.

  1. Some default configuration (per file type)
  2. Ability to adjust that global configuration when instance is created
  3. Ability to override the global configuration per upload_field instance