Setup Menus in Admin Panel

  • No products in the cart.

  • LOGIN

File Uploading

PHP file Upload:

PHP allows you to upload single and multiple files through few lines of code. PHP file upload features allows you to upload text and binary files both. Apart from this, you can have the full control over the file to be uploaded through PHP authentication and file operation functions.

PHP file upload example:-

<!DOCTYPE html>
<html>
<head>
<title>Upload your files</title>
</head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
<p>Upload your file</p>
<input type="file" name="uploaded_file"></input><br />
<input type="submit" value="Upload"></input>
</form>
</body>
</html>
<?PHP
if(!empty($_FILES['uploaded_file']))
{
$path = "uploads/";
$path = $path . basename( $_FILES['uploaded_file']['name']);
if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $path)) {
echo "The file ". basename( $_FILES['uploaded_file']['name']). 
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
}
?>

ASSIGNMENT : How will you access the uploaded file in PHP? MARKS : 10  DURATION : 1 week, 3 days

ASSIGNMENT : Write a program for uploading a file in PHP. MARKS : 5  DURATION : 10 minutes

SEE ALL Add a note
YOU
Add your Comment
 

Advanced Course Search Widget

Popular Courses

Course Categories

© PHPhelp. 2002 - 2018 All rights reserved.
X