Home > Net >  Display file URL on file upload
Display file URL on file upload

Time:03-28

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?

CodePudding user response:

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;
  • Related