1 / 4
Computer Service
2 / 4
Networking Service
3 / 4
Web Development Service
4 / 4
Software Development Service
TNW - ICT Solutions
  • Home
  • Available Courses 
  • Available Services 
  • Website Samples 
  • Search Log In
  • In this example, we will upload file to the designated location. So, we will create a folder to store the files we've uploaded and give name to that folder. I give it as tnw87. Ok, lets start write the following codes and discover how it works.

    <?php
     $name = $_FILES['file']['name'];
     $type = $_FILES['file']['type'];
     $size = $_FILES['file']['size'];
     $tmp_name = $_FILES['file']['tmp_name'];
     if(@isset($name) && @!empty($name)){
     $location = 'tnw87/';
    
     if(move_uploaded_file($tmp_name, $location.$name)){
      echo $name. ' is successfully uploaded.';
     }else{
      echo 'Upload Errors';
     }
     }else{
      echo 'Please select file to upload';
     }
     ?>
    
     <style type = "text/css">
     form{margin-top : 100px; margin-left : 50px;}
     </style>
    
     <form action = "upload.php" method = "POST" enctype = "multipart/form-data">
     <input type = "file" name = "file"></br></br>
     <input type = "submit" value = "Upload">
     </form>