# List of upload functions
# Basic function
# open()
This is the main method that loads the upload popup.
<script src="//www.uploader.win/js/latest/app.js"></script> <script> let uploader = new UploaderWindow('your-api-key'); uploader.open().then(uploads => console.log("uploads: ", uploads)); </script>
The function returns a
promise
that resolves with a list of uploads (always anArray
).Each uploaded item in the array is an Object containing the following keys:
url
,name
,type
(mime type),tags
(only images),size
(in bytes), andthumbnail
(only for photo/video uploads).
# Other functions (for advanced users only)
The functions given below are for expert users only and very rarely used. Unless you have a very specific upload need, please skip ahead to the next section here
# dragdrop('#ele-id')
Makes it possible to drag and drop files on to an HTML element identified by 'ele-id'.
For example: if you have an element like this on your webpage:
<div id="ele-id">drag files here</div>
Then calling
uploader.dragdrop('ele-id')
will make it possible to attach files by dropping files on this element.# embed('#ele-id')
Insert UploaderWindow popup into an HTML element identified by 'ele-id' (instead of showing it in a popup).
For example: if you have an element like this on your webpage:
<div id="ele-id">this will be replaced by uploader</div>
Then calling
uploader.embed('ele-id')
will replaced the contents of the div with Uploader window.:::tip Like the
open
method, all these function also returns a promise that resolves with a list of uploads with upload URL and details. :::