\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 asynchronous upload of files. For more details, refer to the article on the async mode of the Upload.
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 was 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
Fires when the files are cleared by clicking on the Clear button. 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 complete—either successfully or with errors. 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 directory setting is available only in browsers which 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. The directoryDrop setting is available only in browsers which 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 drop-zone element based on a given selector, which provides the 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 (if set to true) or disables (if set to false) an Upload. To re-enable a disabled Upload, use enable().
Returns
\Kendo\UI\Upload
Parameters
$value boolean
Example
<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->enabled(true);
?>
error
Fires when an upload or remove operation fails. 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 (if set to true) or disables (if set to false) the selection of multiple files. If set to false, the user can select only one file at a time.
Returns
\Kendo\UI\Upload
Parameters
$value boolean
Example
<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->multiple(true);
?>
pause
Fires 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. 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
Fires when a file is selected. 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 (if set to true) or disables (if set to false) the display of a file listing for the file upload. The disabling of a file listing might be useful if you want to customize the UI. To build your own UI, use the client-side events.
Returns
\Kendo\UI\Upload
Parameters
$value boolean
Example
<?php
$upload = new \Kendo\UI\Upload('Upload');
$upload->showFileList(true);
?>
success
Fires when an upload or remove operation is 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
Sets a template for rendering the files in the file list.The template data Array consists of: name - The name of the file. If in batch upload mode, represents a string combination of all file names separated with comma.; size - The file size in bytes. If in batch upload mode, represents the total file size. If not available, the value is null. or files - An array which contains information about all selected files (name, size, and extension)..
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. The canceling of the event prevents 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));
?>