The most viewed posts

Registry Reviver

How to clean up Windows Computer

About Desktop Icons in Windows Computer

Driver Booster

CCleaner

How to make a computer secure and run faster

Myanmar font and keyboard for Windows

Advanced System Care

some (JavaScript Array Method)

Web Development Services

The most viewed items

Desktop Hard Disk

Dell Inspiron 5559

HP ProBook 430

SONY Playstation Portable

Laptop RAM

External Hard Disk

Laptop

ZilaStar ICT Jun 18 2019, 11:23:14
Category : php tutorials

Codes for file upload in php (step3)

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>

  • Comments:

    No comment to show.

    To Contact
    Available Services
    Terms and Conditions