4

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

AMAGR
  • 59
  • 1
  • 1
  • 4
  • 1
    Possible duplicatie of [this](http://stackoverflow.com/questions/10683192/how-to-get-the-filename-from-input-type-file-html-element-using-javascript-or-jq) SO question – Jeroen Heier Feb 05 '17 at 09:14

1 Answers1

11
echo $_FILES['fileToUpload']['name'];
ScreamX
  • 339
  • 1
  • 3
  • 13
Peyman abdollahy
  • 799
  • 1
  • 8
  • 18