Saturday 25, October 2014
Welcome Guest, Register | Login  
      Home    |    Tutorials    |    Free Ebooks    |    Free Scripts    |    Articles    |    Blog     |    About Us    |    Contact Us

File Upload

You must first build an HTML form that lets users select a file to upload.

 


Select file to upload:


>

uploadfile.php code:

 

$target_path = "myfiles/";

 

$target_path = $target_path . basename( $_FILES[‘file’]['name']);

 

if(move_uploaded_file($_FILES[‘file’]['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES[‘file’]['name'])." has been uploaded";
} else{
    echo "Error Uploading File, Please try again.";
}

 

 

$_FILES['file']['name']
It contains the original path of the user uploaded file.

 

$_FILES['file']['tmp_name']

It contains the path to the temporary file that resides on the server. The file should exist on the server in a temporary directory with a temporary name.

 

The include() Function:
The include() function takes all the text in a specified file and copies it into the file that uses the include function.
Example:



Welcome to The Home Page




 

 

 
     
   
PHP Tutorial
 
  Introduction
Introduction
  Variables
Variables
  Strings
Strings
  Operators
Operators
  If Else Statement
If Else Statement
  Loops
Loops
  Functions
Functions
  Forms
Forms
  Sessions
Sessions
  Cookies
Cookies
  Files
Files
  E-mail
E-mail
  Error Handling
Error Handling
  File Upload
File Upload
  PHP Databases
PHP Databases
  Connecting to a MySQL Database
Connecting to a MySQL Database
  MySQL Data Types
MySQL Data Types
  Inserting Data Into a Table
Inserting Data Into a Table
  Select Statement
Select Statement
  Where Clause
Where Clause
  Order By
Order By
  Update Statement
Update Statement
  Delete From Statement
Delete From Statement
 
 
 
Web Designing Tutorials
  HTML Tutorial
HTML Tutorial
  DHTML Tutorial
DHTML  Tutorial
  CSS Tutorial
CSS Tutorial
  XHTML Tutorial
XHTML Tutorial
 
Programming Languages Tutorials
  C Language Tutorial
C Language Tutorial
  C++ Tutorial
C++ Tutorial
  Java Language Tutorial
Java Language Tutorial
  Data Structure Theory Tutorial
Data Structure Theory Tutorial
 
Server Side Scripting Tutorials
  PHP Tutorial
PHP Tutorial
  SQL Tutorial
SQL Tutorial
  ASP Tutorial
ASP Tutorial
 
Client Side Scripting Tutorials
  JavaScript Tutorial
JavaScript Tutorial
  VBScript Tutorial
VBScript Tutorial
 
 
 
POPULAR E-BOOKS
 
Download List Creation Secrets Leaked Chapters  Ebook List Creation Secrets Leaked Chapters
   
Download Introduction to Object-Oriented Programming Using C++  Ebook Introduction to Object-Oriented Programming Using C++
   
Download Optimizing C++ Ebook Optimizing C++
   
Download 5 Tips for successful Small Business Marketing Ebook 5 Tips for successful Small Business Marketing
   
Download Closing the Sale Ebook Closing the Sale
   
     
Studiesinn.com 2014 All Rights Reserved.
 
Website Designed & Developed by TechXprtz