0
안녕하세요, 저는 제품과 관련된 데모 파일을 다운로드 할 수있게하려고합니다. 내 코드는 내가Php force 다운로드 - 손상된 파일 다운로드
$ 데모하여 제품과 관련된 파일 이름을 얻을 수 있어요이
if(isset($_POST['submit'])){ $root = $_SERVER['DOCUMENT_ROOT']; $path = "/download/"; $path = $root.$path; $filename = $demo; $file = $path.$filename; header('Content-Type: application/force-download'); header("Content-Transfer-Encoding: Binary"); header("Content-Disposition: attachment; filename=\"".basename($file)."\";"); header("Content-Length: ".filesize($file)); readfile($file); }
처럼
사용자 후
자신의 정보를 제출, 다운로드가 자동으로 시작됩니다 . 이제는 존재하지 않는 파일이나 손상된 파일을 적절한 파일 이름으로 다운로드합니다. 도와주세요
큰 도움이됩니다! @ 설정. 이것은 효과가 있었다. 자세한 답변을 주셔서 감사합니다. – Sanjeev