Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP/HTML how to get filename from form?

Tags:

html

forms

php

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

like image 932
AMAGR Avatar asked Dec 18 '22 09:12

AMAGR


1 Answers

echo $_FILES['fileToUpload']['name'];
like image 62
Peyman abdollahy Avatar answered Dec 28 '22 18:12

Peyman abdollahy