Here is the code I am using:
________The form
<form action="upload_file.php" method="post" enctype="multipart/form-data">
<label for="file">Select Filename:</label> <input type="file" name="file" id="file" />
<br /><input type="submit" name="submit" value="Upload File" /> </form>
-----The upload_file.php
<?php $target_path = "upload/";
$filename = $_FILES['file']['name'];
$uploadFile = $target_path . $_FILES['file']['name'];
move_uploaded_file($_FILES['file']['tmp_name'], $target_path);
if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['file']['name']). " has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";} ?>
_________________________________________________________________
Whenever I upload a file I get my error message "There was an error uploading the file, please try again!". I don't seem to see what's wrong with it so I thought anyone could help. Thanks
________The form
<form action="upload_file.php" method="post" enctype="multipart/form-data">
<label for="file">Select Filename:</label> <input type="file" name="file" id="file" />
<br /><input type="submit" name="submit" value="Upload File" /> </form>
-----The upload_file.php
<?php $target_path = "upload/";
$filename = $_FILES['file']['name'];
$uploadFile = $target_path . $_FILES['file']['name'];
move_uploaded_file($_FILES['file']['tmp_name'], $target_path);
if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['file']['name']). " has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";} ?>
_________________________________________________________________
Whenever I upload a file I get my error message "There was an error uploading the file, please try again!". I don't seem to see what's wrong with it so I thought anyone could help. Thanks