1. Create send.php with upload form and button.
2. Display the content of uploaded file.
Take a look at the gist below. If it is not visible then you can go this link.
https://gist.github.com/codesynapse/6082642
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>File Upload Example</title> | |
</head> | |
<body> | |
<form method="post" action="upload.php" enctype="multipart/form-data"> | |
<label> Upload your file</label><br/> | |
<input type="file" name="file" id="file"><br/> | |
<input type="submit" name="submit"> | |
</form> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>File Upload Status</title> | |
</head> | |
<body> | |
<?php | |
//by using $_files array you can store data from client computer to the remote server | |
//check if the file is uploaded, if not then pass the error | |
if($_FILES['file']['error']>0) { | |
echo 'Error :'.$_FILES['file']['error']."<br/>"; | |
} | |
//if the file is uploaded successfully, echo the file size, type and location | |
echo "Upload ". $_FILES['file']['name']."<br/>"; | |
echo "Type ". $_FILES['file']['type']."<br/>"; | |
echo "Size ".($_FILES['file']['size']/1024) ."<br/>"; | |
echo "Stored in :".$_FILES['file']['tmp_name']."<br/>"; | |
?> | |
</body> | |
</html> |