ダウンロード用のzipファイルを配信するPHPプログラムを作成しようとしています。インターネットで検索し、すべての解決策を試しましたが、問題は解決しません。
私の問題は、zip ファイルがユーザーのコンピューターにダウンロードされると、パス全体が zip ファイルの名前として表示されることです。
例: Zip ファイルへのパス: "http://www.websitename.com/folder1/folder2/" Zip ファイルの名前: "zbc123.zip"
ブラウザが zip ファイルをダウンロードすると、ファイルの名前は次のようになります: http-_www.websitename.com_folder1_folder2_zbc123.zip
パスをダウンロードした zip ファイルの名前にしたくありません。
実際のzipファイルのみを表示したい。
ここに私のコードスペックがあります:
$m_item_path_name = "http://www.websitename.com/folder1/folder2/";
$m_zip_file_name = "zbc123.zip"
//Combining the Path and the Zip file name and storing into memory variable
$m_full_path = $m_item_path_name.$m_zip_file_name;
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$m_zip_file_name."\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($m_item_path_name.$m_zip_file_name));
ob_end_flush();
@readfile($m_item_path_name.$m_zip_file_name);
誰でもこの問題を解決するのを手伝ってくれますか?
あらゆる種類の助けをいただければ幸いです。
どうもありがとう。