Posts

Showing posts from April, 2022

File upload using JavaScript with validation (Apply validation on frontend side)

 JavaScript is a client side scripting language. With JavaScript we can easily validate our file with extension, file size.  input element object .files   <form action="" method="POST" enctype="multipart/form-data" id="form"> <label>Upload</label> <input class="w3-input w3-white" id="file" name="file" type="file" /> <input name="upload" type="hidden" value="" /> <button id="Upload" name="upload" type="submit">Upload</button> </form> <div id="embed"></div> <script>  document.getElementById('Upload').addEventListener('click', (e) => {    e.preventDefault();    if(document.getElementById('file').value){ // console.log(document.getElementById('file').files);  All property of file     var files = document.getElementById('file...

How to remove 000webhost watermark

  000webhost.com is a free web hosting service provider website. Which offer free and premium hosting services. 000webhost does not permit turn off banner powered by 000webhost with free account. There are some other method which will work. work. Paste this code in every page of your website or webpage. This will remove the Russia/Ukraine war watermark or banner from the footer of the webpage. Paste this code in the script tag at the end of the body element. document.addEventListener('DOMContentLoaded', () => { var disclaimer = document.querySelector("img[alt='www.000webhost.com']"); if(disclaimer){ disclaimer.remove(); } });

File upload along with data and apply proper validation in PHP

  File : <form method="post" action="save-file.php" enctype="multipart/form-data">   <input name="file" type="file" />   <input name="submit" type="submit" /> </form> save-file.php if(isset($_POST['submit'])){ if((isset($_FILES['file']['name'])){ $errors = array(); $file_name = $_FILES['file']['name']; $file_size = $_FILES['file']['size']; $file_tmp = $_FILES['file']['tmp_name']; $file_type = $_FILES['file']['type']; $ext = explode('.', $file_name); $file_ext = end($ext); $extensions = array('pptx', 'PPTX','pdf', 'PDF', 'ppt', 'PPT', 'docx', 'DOCX'); if(in_array($file_ext, $extensions) === FALSE){ $errors[] = "This extension file is not all...

How to remove (Russia/Ukrain war) watermark from 000webhost

000webhost.com is a free web hosting service provider website. Which offer free and premium hosting services. 000webhost does not permit turn off banner powered by 000webhost with free account. There are some other method which will work. work. Paste this code in every page of your website or webpage. This will remove the Russia/Ukraine war watermark or banner from the footer of the webpage. Paste this code in the script tag at the end of the body element. document.addEventListener('DOMContentLoaded', () => { var disclaimer = document.getElementsByClassName('disclaimer'); if(disclaimer){ disclaimer[0].remove() } }); This will remove watermark.