I really checked everything and went through all the examples but didn't find solution. Basically what I'm trying to do is to simply upload XML file and store it to the specific folder.The folder is created and I'm using XAMPP localhost.
My code looks like this:
HTML
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST" enctype="multipart/form-data">
<div class="row">
<div class="form-group col-lg-4 col-md-4 col-xs-4 col-sm-4">
<input type="file" name="fileToUpload" id="fileToUpload" accept="text/xml">
</div>
</div>
<div class="row">
<div class="col-lg-4 col-md-4 col-xs-4 col-sm-4">
<button type="submit" class="btn btn-default" id="uploadFile" name="uploadFile" style="width: 100%">Upload</button>
</div>
</div>
</form>
PHP
<?php
if (isset($_POST['uploadFile'])) {
$name = $_FILES["fileToUpload"]["name"];
$tmp_name = $_FILES['fileToUpload']['tmp_name'];
$location = 'uploads/';
move_uploaded_file($tmp_name, $location.$name);
//also tried this -> copy($tmp_name, $location.$name);
}
?>
Thanks in advance,
B.