Re: Re: [PHP-DEV] php download file via https problem
| From: | searoc | Date: | Mon, 06 Nov 2000 09:55:51 +0000 |
| Subject: | Re: Re: [PHP-DEV] php download file via https problem | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-37240@lists.php.net to get a copy of this message | ||
thank you for your answer
the whole code is work in gif,txt,html
but is not work in octet-stream via https.
you can visit in https://test.enp.vinside.com/filelist.html
system environment
linux + apache1.3.14 + php3.0.16 + mysql + mod_ssl
<?
include("org_global.inc");
//download shared file
$userid =$array_session[PUID];
$user_db=new DB_Sql;
$user_db->connect($org_database,$org_database_host);
$usersql="select Ffile_id,Ffile_name,Fcreate_time,Fpath,Ffile_type,Ffile_size"
." from t_user_file where Fowner_uid=".$userid." and
Ffile_id=".$Ffile_id." and Ffold_id=".$Ffold_id."";
$user_db->query($usersql);
$user_db->next_record();
$urlt=$user_db->Record;
if(strtolower($urlt["Ffile_type"])=="gif")
{
header("Content-Type: image/gif");
header("Content-Length: ".$urlt["Ffile_size"]);
}
elseif(strtolower($urlt["Ffile_type"])=="jpg")
{
header("Content-Type: image/pjpeg");
header("Content-Length: ".$urlt["Ffile_size"]);
}
elseif(strtolower($urlt["Ffile_type"])=="txt")
{
header("Content-Type: text/plain");
header("Content-Length: ".$urlt["Ffile_size"]);
}
elseif(strtolower($urlt["Ffile_type"])=="htm")
{
header("Content-Type: text/html");
header("Content-Length: ".$urlt["Ffile_size"]);
}
elseif(strtolower($urlt["Ffile_type"])=="html")
{
header("Content-Type: text/html");
header("Content-Length: ".$urlt["Ffile_size"]);
}
else
{
header("Content-Length: ".$urlt["Ffile_size"]);
header("Content-Type: application/octet-stream; attachment;
name=".$urlt["Ffile_name"]);
header("Content-Disposition: attachment ;
filename=".$urlt["Ffile_name"].".".$urlt["Ffile_type"]."");
}
readfile($urlt["Fpath"]);
?>
>On Mon, 6 Nov 2000, searoc wrote:
>
>> hi,i hava a problem this download file via https using php,
>> this script can download file via http,
>> but can not download file via https,
>> maybe http header is not right. can you help me.
>> thanks.
>
>It works for me, with the same code (except with a gif file) I am
>using Apache 1.3.14 with mod_ssl 2.7.1 and PHP 4.0.3pl1, with the EAPI and
>the mm library.
>
>Can you give me a URL so I can see it in action and know the exact
>problem?
>
>>
>> -----------------------------
>> <?php
>> $realname="/usr/local/disk/1";
>> $file_name="test.dat";
>>
>> header("Content-Length: ".filesize($realname));
>> header("Content-Type: application/octet-stream; attachment; name=".$file_name);
>> header("Content-Disposition: attachment ; filename=".$file_name);
>>
>> readfile($realname);
>> ?>
>> --------------------
>>
>>
>>
>> --
>> PHP Development Mailing List <http://www.php.net/>
>> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
>> For additional commands, e-mail: php-dev-help@lists.php.net
>> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>>
>
>
>------------------------------------------------------------
>Jean-Michel Dault <jmdault@mandrakesoft.com>
>MandrakeSoft inc, Montreal (Canada)
>HTCPCP/1.0 Developper (http://www.ietf.org/rfc/rfc2324.txt)
>
>
>--
>PHP Development Mailing List <http://www.php.net/>
>To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
>For additional commands, e-mail: php-dev-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net