======
upload
======

.. js:function:: upload(options)

**domain**: client 

**language**: javascript

**class** :doc:`Task </refs/client/task_api>`

Description
===========

Use the ``upload`` method to select a file in the File open dialog box and 
upload it to the *static/files* directory in the server folder. 

When saving the file on the server, the file name is changed by the Werkzeug 
secure_filename function and then the current date is added to it. See
http://werkzeug.pocoo.org/docs/0.14/utils/

The ``options`` parameter is an object that may have the following attributes:

* ``callback`` - is a callback function that is executed when the file is 
  downloaded. It is passed, as parameters, the name of the file stored on the 
  server, the name of the downloaded file and the path to the folder where 
  the file was saved.

* ``show_progress`` - if true and the uploaded file is large, the progress bar 
  will be displayed. the defaul value is true

* ``accept`` - the attribute specifies the types of files that can be submitted 
  through a file upload. It is the string the same as the html <input> accept 
  attribute. See https://www.w3schools.com/Tags/att_input_accept.asp
