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

1
  • 1
    Possible duplicatie of this SO question Commented Feb 5, 2017 at 9:14

1 Answer 1

12
echo $_FILES['fileToUpload']['name'];
Sign up to request clarification or add additional context in comments.

1 Comment

@AMAGR your welcome, you can mark my answer as answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.