Get image name on upload
$_FILES['userfile']['name']The original file name on the client machine.
Thus, using the above, if you want the actual file name cow.jpg, it is stored in
$_FILES['picture']['name'];
, pathinfo(), PATHINFO_FILENAME, cow. cow.moo.jpg, cow.moo:
$picture_filename = pathinfo($_FILES['picture']['name'], PATHINFO_FILENAME);
Use this
<html>
<body>
<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
Upstairs script
<?php
echo "Upload: " . $_FILES["file"]["name"] . "<br>";
echo "Type: " . $_FILES["file"]["type"] . "<br>";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
?>
This will give you the file name, file type and file size.