Hello again, i have copied the two files named upload_home.php and fileUpload.php to my xampp installation. I altered the code a bit with request method and tried he form. The path set in the dir variable was incorrect. I used a folder named uploads and placed a folder in the uploads folder named folder and the code works for me.
upload.php
<html>
<head>
<title>Upload files</title>
</head>
<body>
<div data-role="page" id="page">
<div data-role="header">
<h1>Upload files</h1>
<a href="logout.php" data-role="button" data-icon="home">Sign out</a>
</div>
<div data-role="content">
<form action="/upload/fileUpload.php" method="post" enctype="multipart/form-data">
<input type="file" name="Upload">
<input type="submit">
</form>
</div>
</div>
</body></html>
fileUpload.php
<html>
<head>
<title>Fileupload</title>
</head>
<body>
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$dir = "folder/";
$timestamp = time();
$filename = $dir.$timestamp.basename($_FILES['Upload']['name']);
var_dump($_FILES);
echo '<br><br>';
if (move_uploaded_file($_FILES['Upload']['tmp_name'], $filename)){
echo '<p>File was uploaded --> '.$_FILES['Upload']['name']);
} else {
echo 'Upload failed'.$_FILES['Upload']['name']);
}
echo '<p>Information about file from $FILE array</p>';
echo 'File Name: '.$_FILES['Upload']['name'].'<br>';
echo 'File Type: '.$_FILES['Upload']['type'].'<br>';
echo 'File Size: '.$_FILES['Upload']['size'].'kB<br>';
}
?>
</body></html>
so it seems as though your path to folder is incorrect. You should enable php errors because it will show you a 'cannot move to folder' message.