fires the moment you try to add file to uploader

boolean onBeforeFileAdd(object file){ ... };


fileobjectan object with the file data


booleanreturning false will prevent further processing of a file


$$("uploader_1").attachEvent("onBeforeFileAdd", function(file){
    var type = file.type.toLowerCase();
    if (type != "jpg" && type != "png"){
        webix.message("Only PNG or JPG images are supported");
        return false;

Related samples


The file object contains the following properties:

  • id - the file ID generated automatically with the webix.uid() method per each uploading session;
  • name - the file title and extension;
  • percent - the indicator of the loading progress;
  • size - the size of the file in bytes (as a number);
  • sizetext - the size of the file as a string, like "522Kb";
  • sname - the file name under which it was saved on server;
  • status - the upload status that changes during uploading:
    • "client" - the file is added to the uploader body on the client side, the uploading hasn't been started yet or was aborted by a user;
    • "transfer" - the file uploading is in progress;
    • "server" - the file has been successfully uploaded;
    • "error" - an error occurred during uploading.
  • type - the file extension.

If the method returns false further processing of a file (i.e. adding it to the client-side storage and uploading) will be blocked.

See also
Back to top