Month: April 2019

javascript

Check Filesize & Extension before upload (Javascript)

Input <input type=”file” onchange=”ValidateFile(this);” id=”uploaded_file”>   Function for checking upon on change for uploaded file function ValidateFile(file){     var FileSize = file.files[0].size / 1024 / 1024; //In MB     var filePath = file.files[0].name;    var extension = filePath.substr((filePath.lastIndexOf(‘.’) +1));     var allowed_extension = [“jpg”,”png”,”jpeg”];     if (FileSize > 2) {   […]

bash Linux

SSH Trick

How To SSH run command without key-in password again echo < password > | ssh username@host ‘sudo -S < command >’ Running Two SSH Command line for sqldump ssh -t username@host ‘mysqldump -u {DB_USER} -p”{DB_PASS}” {DB_NAME}’ > dump.sql | ssh -t username@host ‘cat dump.sql’ > local.sql

Back To Top