M
M
mantovpinets2017-09-04 17:01:15
Angular
mantovpinets, 2017-09-04 17:01:15

How to get file from server in Angular?

Good day.

I am developing a web application using angular and php. The form has fields that are sent to the server and a Word file is generated, which then must be immediately downloaded to the user's computer. Data is sent from the client using angular, and php is running on the server. The question is this: how do I get php to send a file as a response, which would be immediately downloaded to the client?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrei Smirnov, 2017-09-04
@pinebit

In the response (php script) put a Content-Type header and choose a mime type for your file. Then, using the same php, feed the generated file into response. All. The browser will look at the content-type and prompt the user to save it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question