\Kendo\UI\Upload

A PHP wrapper for Kendo UI Upload.

Inherits from \Kendo\UI\Widget.

Usage

To use Upload in a PHP page instantiate a new instance, configure it via the available configuration methods and output it by echo-ing the result of the render method.

Using Kendo Upload

<?php
// Create a new instance of Upload and specify its id
$upload = new \Kendo\UI\Upload('Upload');

// Configure it
$upload->directory(true)

// Output it

echo $upload->render();
?>

Methods

async

Configures the ability to upload a files in an asynchronous manner. Please refer to the async mode help topic for more details.

Returns

\Kendo\UI\Upload

Parameters

$value \Kendo\UI\UploadAsync |array

Example - using \Kendo\UI\UploadAsync

<?php
$upload = new \Kendo\UI\Upload('Upload');
$async = new \Kendo\UI\UploadAsync();
$autoRetryAfter = 1;
$async->autoRetryAfter($autoRetryAfter);
$upload->async($async);
?>

Example - using array

<?php
$upload = new \Kendo\UI\Upload('Upload');
$autoRetryAfter = 1;
$upload->async(array('autoRetryAfter' => $autoRetryAfter));
?>

cancel

Fires when the upload has been cancelled while in progress. For additional information check the cancel event documentation.

Returns

\Kendo\UI\Upload

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->cancel('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onCancel(e) {
        // handle the cancel event.
    }
</script>
<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->cancel('onCancel');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->cancel(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

clear

Triggered when files are cleared by clicking on the "Clear" button. Note: Cancelling this event will prevent the clearing the selected files. For additional information check the clear event documentation.

Returns

\Kendo\UI\Upload

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->clear('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onClear(e) {
        // handle the clear event.
    }
</script>
<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->clear('onClear');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->clear(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

complete

Fires when all active uploads have completed either successfully or with errors.Note: The complete event fires only when the upload is in async mode. For additional information check the complete event documentation.

Returns

\Kendo\UI\Upload

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->complete('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onComplete(e) {
        // handle the complete event.
    }
</script>
<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->complete('onComplete');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->complete(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

directory

Enables the selection of folders instead of files. When the user selects a directory, its entire content hierarchy of files is included in the set of selected items. The setting supported only in browsers that support webkitdirectory.

Returns

\Kendo\UI\Upload

Parameters

$value boolean

Example

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->directory(true);
?>

directoryDrop

Enables the dropping of folders over the Upload and its drop zone. When a directory is dropped, its entire content hierarchy of files is included in the set of selected items. This setting is supported only in browsers that support DataTransferItem and webkitGetAsEntry.

Returns

\Kendo\UI\Upload

Parameters

$value boolean

Example

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->directoryDrop(true);
?>

dropZone

Initializes a dropzone elements based on a given selector that provides drag and drop file upload.

Returns

\Kendo\UI\Upload

Parameters

$value string

Example

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->dropZone('value');
?>

enabled

Enables (true) or disables (false) an Upload. A disabled Upload may be re-enabled via enable().

Returns

\Kendo\UI\Upload

Parameters

$value boolean

Example

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->enabled(true);
?>

error

Fires when an upload / remove operation has failed.Note: The error event fires only when the upload is in async mode. For additional information check the error event documentation.

Returns

\Kendo\UI\Upload

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->error('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onError(e) {
        // handle the error event.
    }
</script>
<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->error('onError');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->error(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

addFile

Adds one or more UploadFile to the Upload.

Returns

\Kendo\UI\Upload

Parameters

$value[, $value2, ...] \Kendo\UI\UploadFile |array

Example - using \Kendo\UI\UploadFile

<?php
$upload = new \Kendo\UI\Upload('Upload');
$file = new \Kendo\UI\UploadFile();
$extension = 'value';
$file->extension($extension);
$upload->addFile($file);
?>

Example - using array

<?php
$upload = new \Kendo\UI\Upload('Upload');
$extension = 'value';
$upload->addFile(array('extension' => $extension));
?>

Example - adding more than one UploadFile

<?php
$upload = new \Kendo\UI\Upload('Upload');
$first  = new \Kendo\UI\UploadFile();
$second = new \Kendo\UI\UploadFile();
$upload->addFile($first, $second);
?>

localization

Sets the strings rendered by the Upload.

Returns

\Kendo\UI\Upload

Parameters

$value \Kendo\UI\UploadLocalization |array

Example - using \Kendo\UI\UploadLocalization

<?php
$upload = new \Kendo\UI\Upload('Upload');
$localization = new \Kendo\UI\UploadLocalization();
$cancel = 'value';
$localization->cancel($cancel);
$upload->localization($localization);
?>

Example - using array

<?php
$upload = new \Kendo\UI\Upload('Upload');
$cancel = 'value';
$upload->localization(array('cancel' => $cancel));
?>

multiple

Enables (true) or disables (false) the ability to select multiple files. If false, users will be able to select only one file at a time. Note: This option does not limit the total number of uploaded files in an asynchronous configuration.

Returns

\Kendo\UI\Upload

Parameters

$value boolean

Example

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->multiple(true);
?>

pause

Triggered when the files are cleared by clicking the Pause button. The button is visible if chunksize is set. For additional information check the pause event documentation.

Returns

\Kendo\UI\Upload

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->pause('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onPause(e) {
        // handle the pause event.
    }
</script>
<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->pause('onPause');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->pause(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

progress

Fires when the data about the progress of the upload is available. For additional information check the progress event documentation.

Returns

\Kendo\UI\Upload

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->progress('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onProgress(e) {
        // handle the progress event.
    }
</script>
<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->progress('onProgress');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->progress(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

remove

Fires when an uploaded file is about to be removed. If the event is canceled, the remove operation is prevented. For additional information check the remove event documentation.

Returns

\Kendo\UI\Upload

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->remove('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onRemove(e) {
        // handle the remove event.
    }
</script>
<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->remove('onRemove');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->remove(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

resume

Fires when the files are resumed through clicking the Resume button. The button is visible if chunksize is set and the file upload is paused.The following example demonstrates how to wire up an event handler that is triggered when a user resumes a selected file. For additional information check the resume event documentation.

Returns

\Kendo\UI\Upload

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->resume('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onResume(e) {
        // handle the resume event.
    }
</script>
<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->resume('onResume');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->resume(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

select

Triggered when a files is selected. Note: Cancelling this event will prevent the selection from occurring. For additional information check the select event documentation.

Returns

\Kendo\UI\Upload

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->select('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onSelect(e) {
        // handle the select event.
    }
</script>
<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->select('onSelect');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->select(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

showFileList

Enables (true) or disables (false) the ability to display a file listing for uploading a files. Disabling a file listing may be useful you wish to customize the UI; use the client-side events to build your own UI.

Returns

\Kendo\UI\Upload

Parameters

$value boolean

Example

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->showFileList(true);
?>

success

Fires when an upload / remove operation has been completed successfully. For additional information check the success event documentation.

Returns

\Kendo\UI\Upload

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->success('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onSuccess(e) {
        // handle the success event.
    }
</script>
<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->success('onSuccess');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->success(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

template

The template used to render the files in the list

Returns

\Kendo\UI\Upload

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->template('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->template(new \Kendo\JavaScriptFunction('function() { }'));
?>

upload

Fires when one or more files are about to be uploaded. Canceling the event will prevent the upload. For additional information check the upload event documentation.

Returns

\Kendo\UI\Upload

Parameters

$value string |\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->upload('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onUpload(e) {
        // handle the upload event.
    }
</script>
<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->upload('onUpload');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->upload(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

validation

Configures the validation options for uploaded files.

Returns

\Kendo\UI\Upload

Parameters

$value \Kendo\UI\UploadValidation |array

Example - using \Kendo\UI\UploadValidation

<?php
$upload = new \Kendo\UI\Upload('Upload');
$validation = new \Kendo\UI\UploadValidation();
$maxFileSize = 1;
$validation->maxFileSize($maxFileSize);
$upload->validation($validation);
?>

Example - using array

<?php
$upload = new \Kendo\UI\Upload('Upload');
$maxFileSize = 1;
$upload->validation(array('maxFileSize' => $maxFileSize));
?>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve the information

close
Dummy