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
Post a Comment