HTMLInputElement Class
Item Index
Methods
Methods
resetFileSelect
()
chainable
Hides the pop-up and empties the files-list of an input element of the type file.
sendFiles
-
url -
[params] -
[options]
Sends the input's files by using an AJAX PUT request.
Additional parameters can be through the params argument.
The Promise gets fulfilled if the server responses with STATUS-CODE in the 200-range (excluded 204).
It will be rejected if a timeout occurs (see options.timeout), or if xhr.abort() gets invoked.
Note: params should be a plain object with only primitive types which are transformed into key/value pairs.
Parameters:
-
urlStringURL of the resource server
-
[params]Object optionaladditional parameters. NOTE: these will be set as HEADERS like
x-data-parameteron the request! should be a plain object with only primitive types which are transformed into key/value pairs. -
[options]Object optional-
[sync=false]Boolean optionalBy default, all requests are sent asynchronously. To send synchronous requests, set to true.
-
[headers]Object optionalHTTP request headers.
-
[timeout=300000]Number optionalto timeout the request, leading into a rejected Promise. Defaults to 5 minutes
-
[progressfn]Function optionalcallbackfunction in case you want to process upload-status. Function has 3 parameters: total, loaded and target (io-promise)
-
[withCredentials=false]Boolean optionalWhether or not to send credentials on the request.
-
[parseJSONDate=false]Boolean optionalWhether the server returns JSON-stringified data which has Date-objects.
-
[emptyFiles=true]Boolean optionalWhether the empty the inputElement after transmitting has completed
-
Returns:
on success:
Object any received data
on failure an Error object
reason {Error}
The returned promise has an abort-method to cancel all transfers.
showFileSelect
()
chainable
Shows the pop-up of an input element of the type file.
