I have a problem with some php code:
$link = $_GET['url'];
$name = $_GET['name'];
$str = '[wanted-web.ro]';
header("Content-Disposition: attachment; filename=$str $name");
header("Content-type: audio/mpeg;\r\n");
readfile(str_replace(' ', '_', $link));
That is the code I use to save files. When I want to download some direct files to my computer, that dot what I use in stop writing the rest of information after dot " ", such like this: 使用时停止在点“ ”之后写入其余信息,例如:
Problem SOLVED!
Thank you verry much to all. You are awesome. I combined your comments, and the result is:
header("Content-Disposition: attachment; filename=\"[wanted-web.ro] $name.mp3\"");
That work perfect! Thanks very much to all. Respect!
Quote the filename in the header:
header("Content-Disposition: attachment; filename=\"$str $name\"");
Try this:
<?php
$link = $_GET['url'];
$name = $_GET['name'];
$str = "[wanted-web.ro]";
header("Content-Disposition: attachment; filename=".$str." ".$name);
header("Content-type: audio/mpeg;\r\n");
readfile(str_replace(' ', '_', $link));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.