The most viewed posts

About Desktop Icons in Windows Computer

How to clean up Windows Computer

Driver Booster

CCleaner

Advanced System Care

Myanmar font and keyboard for Windows

Registry Reviver

How to make a computer secure and run faster

some (JavaScript Array Method)

Terms and Conditions

The most viewed items

Desktop Hard Disk

HP ProBook 430

Dell Inspiron 5559

External Hard Disk

SONY Playstation Portable

Laptop RAM

Laptop

ZilaStar ICT Jun 17 2019, 16:57:06
Category : php tutorials

Codes for file upload in php (step2)

When we upload a file into one location, the file is firstly saved in temporary location as a temp file. Ok, lets discover how it works. We will write the following codes and test it.

<?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