AMAGR
AMAGR

Reputation: 59

PHP/HTML how to get filename from form?

I have following code:

    <form action="upload.php" method="post" enctype="multipart/form-data">
       <input type="file" name="fileToUpload" id="fileToUpload">
       <input type="submit" value="Upload Image" name="submit">
</form>

How can i get the name of file i upload so i can save the path to database? I need only name of file, not the whole path. Thank you

Upvotes: 4

Views: 20137

Answers (1)

Peyman abdollahy
Peyman abdollahy

Reputation: 829

echo $_FILES['fileToUpload']['name'];

Upvotes: 12

Related Questions