README
Send a file to server
Install:
npm i f-send --save
Usage:
- import into service o component
import { fileSend } from "fileSend";
- inject in the constructor
construct( private _fs:fileSend ){}
- usage:
_fs.send( File, "http://localhost:4002/upload" , "PUT" ,"imagen", true )
.then( r =>{
console.log(r) // server response
});
'State' property returns the state an XMLHttpRequest
Value | Description |
---|---|
0 | Client has been created. open() not called yet. |
1 | XmlHttpRequest.open() has been called. |
2 | XmlHttpRequest.send() has been called, and headers and status are available. |
3 | Downloading; responseText holds partial data. |
4 | The operation is complete. |
let percentage:number;
percentage = _fs.State * 25;
// 1 => 25%
// 2 => 50%
// 3 => 75%
// 4 => 100%