======
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, see :doc:`Accept string </admin/accept_string>` 
  

.. note::

  Please note that the ``accept`` attribute specifies only types of files that 
  can be picked up by the user in the browser.
  
  The server checks all uploaded files for compliance with the **Upload file extensions** 
  attribute of the :doc:`Project parameters </admin/project/parameters>`.	

	