views:

159

answers:

1

I have a response which may return text/html or application/octet-stream. If I receive html, I'd like to replace part of the page with the returned response data, and if I receive binary data (a file download), I would like to display a message and send the data to the browser so that the user can download the file. Is there any way to do this?

A: 

The only thing I can think of is to make your download stage two-legged. That is, first request what type of response will happen with the given request data, and then make the actual request and handle both situations appropriately.

Stefan Kendall