I made a PHP file uploader and I need to upload a file in a specific page of a webpage. I use Dreamweaver CS3 to make my websites and PHP files.
But there is a catch, my Manager doesn't know how to upload his Policies in a specific webpage. All policies are in PDF format. For that he wants me to make a PHP File Uploader to upload his files in front hand, for Example: There is a new policy which needs to be uploaded in a specific he/she would need to click on the choose file button, upload and choose the file, rename the following file and upload it in the webpage with ease.
It is easy to upload the Policies using Dreamweaver but my manager doesn't know how to upload files using that kind of method.
I need to make a php uploader, So i can upload my policies and post it in a specific page. How do you create a code for that.
EDIT
I have a html file by the name of uploads.html:
<form action="index1.php" method="post" enctype="multipart/form-data">
<input type="file" name="file" id="file"><br><br>
<input type="submit" value="submit" name="submit">
</form>
and This is the php code (index1.php):
<?php
if(isset($_POST['submit'])){
$name = $_FILES['file']['name'];
$temp_name = $_FILES['file']['tmp_name'];
if(isset($name)){
if(!empty($name)){
$location = '../uploads/';
if(move_uploaded_file($temp_name, $location.$name)){
echo 'uploaded';
}
}
} else {
echo 'please uploaded';
}
}
?>
EDIT
The code for this uploader is for upload file in a specific folder, I need to upload my policies in a specific Webpage or any website. How can I create a code for this? I am sorry but I am new to PHP
I dont have enough reputation to post images so I will just insert the error statements here.
There are the following errors in my php file:
Warning: move_uploaded_file(../uploads/apache_pb2.gif): failed to open stream: No such file or directory in C:\xampp\htdocs\index1.php on line 8
Warning: move_uploaded_file(): Unable to move 'C:\xampp\tmp\phpB959.tmp' to '../uploads/apache_pb2.gif' in C:\xampp\htdocs\index1.php on line 8