Demos
Upload Editor
This demo shows how to
- configure the uploader editor component
- configure the cell editors
- configure the server-side actions for insert, update and delete operations
- use custom data validators
The complete list of the uploader options is available in the documentation available in the purchased package.
Note that is a live demo and your tests will be recorded in a database!
Instructions: Double-click on the Photo or File cell or press enter key to open the inline uploader editor.
Photo | Name | Start Date | Salary | File | Active | |
---|---|---|---|---|---|---|
the highest Date is in 2019... | employee@email.com | 2019-12-01 | 0.00 | |||
asdfsdaf | employee@email.com | 2011-01-01 | 10.10 | |||
dokter dark | dokter_dark@email.com | 2011-01-01 | 0.00 | |||
test | test@email.com | 2011-01-01 | 0.00 | |||
dfddsfg | employee@email.com | 2011-01-01 | 0.00 | |||
nombre | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-06 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
test | employee@email.com | 2011-04-02 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
erg4g24tgh42t | employee@email.com | 2011-01-01 | 0.00 | |||
ze name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-03-12 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
siano na sniadanie dla koziolkadfs | koziolek@email.com | 0000-00-00 | 0.00 | |||
tsting | employee@email.com | 2011-01-05 | 0.00 | |||
Test Me NOW | employee1@email.com | 2011-01-01 | 0.00 | |||
oöoiöoiöoiöioöoiö | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
rrrrr | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
i7i7l78l789 | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
employee@email.com | 2011-01-01 | 0.00 | ||||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
employee@email.com | 2011-01-01 | 0.00 | ||||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
rachunek | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | 1employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
tata | employee@email.com | 2011-01-13 | 0.00 | |||
fggtr | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
yyyy rghfg | employee@email.com | 2011-01-01 | 0.00 | |||
saya juga bisa | employee@email.com | 2011-01-01 | 0.00 | |||
dfsdfsdfsdfsdfsdf | das@ggg.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
ABC | employee@email.com | 2011-01-15 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
gdfgfdgdgdgfdg | employee@email.com | 2011-01-01 | 0.00 | |||
Rrr | employee@email.com | 2011-01-01 | 0.00 | |||
Tyyy | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Employee name... | employee@email.com | 2011-01-01 | 0.00 | |||
Test | employee@email.com | 2011-01-01 | 0.00 |
Configuration object and Uploader object:
//ezEditTable configuration object var demoConfig = { editable: true, default_selection: 'both', editor_model: 'cell', cell_editors:[ { type: 'uploader', uploader: { uri: 'php/uploadFile.php', path: 'images/uploads/', max_file_size: '51200', show_link: false } }, { type: 'input', attributes:[['title', 'First name and last name']] }, { type: 'input', attributes:[['title', 'email address']] }, { type: 'none' }, { type: 'input', attributes:[['maxLength', 10], ['title', '10 digits max.\n numbers with 2 decimal places only']], css:'alignRight' }, { type: 'uploader', uploader: { uri: 'php/uploadFile.php', path: 'images/uploads/', valid_extensions: 'pdf,doc,docx,htm,html,txt', sql_field: 'FILENAME' } }, { type: 'boolean' } ], actions:{ 'update': { uri: 'php/employeeUpdate.php', submit_method: 'form', form_method: 'POST', param_names: ['','name','email','startdate','salary','','active'] }, 'insert': { uri: 'php/employeeInsert.php', submit_method: 'form', form_method: 'POST', param_names: ['','name','email','startdate','salary','','active'], default_record: [ '<img class="icnImg" alt="" src="images/icn_cross.png">', 'Employee name...', 'employee@email.com', '2012-01-01', '0.00', '', '<input type="checkbox" checked>' ] }, 'delete': { uri: 'php/script.deleteEmployee.php', submit_method: 'script', bulk_delete: false, param_names: [''] } }, //Data validation delegate, the script does not provide data validation tools validate_modified_value: function(o, colIndex, oldVal, newVal, cell, editor){ if(colIndex==3 && oldVal != newVal){ if(!et_ValidateEmail(newVal)){ alert('Please insert a valid email!'); return false; } else return true; } else if(colIndex == 5 && oldVal != newVal){ if(!et_IsNumber(newVal)){ alert('Please insert a valid number with 2 decimal places!'); return false; } else return true; } else return true; } }; //Validation functions function et_ValidateEmail(email){ var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; return reg.test(email); } function et_IsNumber(val){ var isPrice = /^\d+\.\d{2}$/; return isPrice.test(val); }
Upload operation (uploadFile.php)
if ($_FILES['UPL_FILE']['error'] > 0){ echo "An error occured!"; return; } if(isset($_POST['MAX_FILE_SIZE']) && isset($_POST['RECORD_KEY']) && isset($_POST['IMAGES_FOLDER_PATH']) && $_FILES['UPL_FILE']['size'] > 0) { $id = $_POST['RECORD_KEY']; $filename = $_FILES['UPL_FILE']['name']; $tmpname = $_FILES['UPL_FILE']['tmp_name']; $filesize = $_FILES['UPL_FILE']['size']; $fieldname = isset($_POST['SQL_FIELD']) ? $_POST['SQL_FIELD'] : "IMAGENAME" ; $maxfilesize = $_POST['MAX_FILE_SIZE']; $imgfolder = $_POST['IMAGES_FOLDER_PATH']; $allowed_extensions = $_POST['VALID_EXTENSIONS']; $allowed_extensions = str_replace(" ", "", $allowed_extensions); $valid_extensions = explode(",", $allowed_extensions); $fileext = strtolower( substr( strrchr($filename, '.') ,1) ); $jscode = stripslashes($_POST['JS_CODE']); if($filesize > $maxfilesize){ echo $filename." exceeds the maximum file size allowed (50Kb)."; return; } else { if( in_array($fileext, $valid_extensions) ){ $ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; $uploadfilename = $id."_".$filename; $filemoved = move_uploaded_file($tmpname, "../".$imgfolder.$uploadfilename); if($filemoved == 1){ connect_db(); $query = "UPDATE ".TBL_DEMO_EMPLOYEE." SET ". "$fieldname='$uploadfilename',MODIP='$ip',MODDATE=NOW()". "WHERE ID='$id'"; mysql_query($query); close_db(); echo $filename." successfully uploaded."; echo str_replace("{0}", stripslashes($uploadfilename), $jscode); return; } else { echo $filename." could not be uploaded. Please try again."; return; } } else { echo $fileext." file extension not allowed."; return; } } } else { echo "File not found!"; return; }
Top of page