php - While downloading pdf file from another server forward slash is get replaced with underscore -


i trying download pdf file server. while downloading file replaces forward slash(/) underscore , file path become this(127.0.0.1_file_upload_demoform1.pdf), because of not able download file.

here code.

header('content-type: application/pdf'); $download_path = "127.0.0.1/file_upload/demoform1.pdf"; header('content-disposition: attachment; filename='.$download_path); readfile('downloads/'.$download_path); 

can suggest issue in it.

i got answer. trying download pdf file server. not allow me directly download location.

here solution.

$content = file_get_contents('http://127.0.0.1/file_upload/demoform1.pdf'); header('content-type: application/pdf'); header('content-disposition: attachment; filename=demoform1.pdf'); echo $content; 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -