cmfdev
cmfdev

Reputation: 50

Display file URL on file upload

I used the tutorial from https://www.w3schools.com/php/php_file_upload.asp. The code works fine, although I have a question: Is there a way to make the page display the file's URL after the upload?

Upvotes: 0

Views: 304

Answers (1)

Milad Elyasi
Milad Elyasi

Reputation: 960

when the move_uploaded_file function did it's functionality, you may concat the base url with target dir and file name!

for example:

echo "www.example.com/".$target_dir.basename($_FILES["fileToUpload"]["name"]);

or simply use:

echo "www.example.com/".$target_file;

Upvotes: 2

Related Questions