D
D
DenPolosin2016-04-15 10:24:59
Angular
DenPolosin, 2016-04-15 10:24:59

How to set a handler in php to a component in angular 2?

I use this script ( https://github.com/jkuri/ng2-uploader) but I don't know how to process the request from the front-end. Front-end everything works, but I don’t know how to combine front-end and back-end. I hope you understand me.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2016-04-15
@DenPolosin

First, separate the angular from the backend in your head. These are all separate pieces and between them http.
Having done this, take a look at the example that is provided directly in the readme: https://github.com/jkuri/ng2-uploader#backend-exam...
Now we will throw out the excess, this is setting CORS headers (this is useful but not required), and checking for POST (although it’s better to do it, but it’s up to you to decide how and where), let’s throw out an example with generating a file name via md5 ... In a word, we should only be interested in this:
That is, this is the simplest and most common upload of files to the server in PHP, of which there are a little more than a million examples on the network.

C
Centrino, 2015-03-23
@Centrino

Just set the php script execution time to 30 seconds through nginx, apache, after which it will simply die.
You can also make an interrupt (although this is overkill), if your loop is running and output through the console after startup, how much time has passed.

S
Sergey Semenko, 2015-03-23
@abler98

php.net/manual/en/function.set-time-limit.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question