Comments (5)
@felixbuenemann Reasonable points. Let's go ahead and remove the middleware.
from jquery-fileupload-rails.
@tors @opti What do you think?
from jquery-fileupload-rails.
@felixbuenemann I have no objections on that. However, I have never faced to the necessity of using this middleware for all the time I have been using this gem.
from jquery-fileupload-rails.
@felixbuenemann I've been struggling with iframe transport and rails and this middleware helped. Are you able to give some examples as to how you handle this in the controller without the middleware?
from jquery-fileupload-rails.
@jhubert I haven't looked at this for a long time. It seems that at the very least the client would have to add a header like 'X-Requested-With: IFrame' so the controller could detect iframe requests and then alter the Content-Type to text/html so eg IE wouldn't show a download prompt. It can then return the response wrapped in a textarea which has data-type, data-status and data-statusText attributes with the relevant data. This is documented in the jquery-iframe-transport.js docs.
I do remember discussing this issue upstream, where I did a PR to include the 'X-Requested-With: IFrame' header in the ajax request, but it was rejected because supposedly there's another way to detect this. If your controller only accepts requests from jquery file uploader, then for non-iframe request request.xhr?
will be truthy and for iframe requests if will be falsy. This technique does not help you if you get normal form uploads without js to the same controller action, because they will look the same as the iframe upload.
You can then do something like this:
respond_to do |format|
format.html do
if request.xhr?
# render normal response
else
# render response wrapped in textarea for iframe transport
end
end
end
from jquery-fileupload-rails.
Related Issues (20)
- sassc dependency break installation on old servers HOT 1
- fileupload() is not function HOT 4
- multipart to allow uploads past 5gb size
- How to get this gem working with Rails 6.
- Release gem v.0.4.4 HOT 3
- Release gem v0.4.5 HOT 1
- jquery fileupload with nested attributes HOT 4
- Can we update the assets for this? HOT 2
- Cant integrate S3 with javascript file upload using presigned post HOT 5
- Use controller or helper instead of model for upload HOT 5
- preview image/video not working HOT 1
- Release gem v0.4.6 HOT 1
- A couple of the asset files seem to be mutually exclusive
- Reuse File Input for a second upload HOT 5
- Widget not working in Rails 5? HOT 1
- Can't direct upload to DreamObjects (S3 compatible OpenStack installation) HOT 3
- Select a file button not responding on production HOT 1
- replace sass with sassc
- Update to support Rails 5.2 HOT 2
- ActionView::Template::Error: Invalid CSS after "screen": expected media query list, was "\" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-fileupload-rails.