RE: [PHP] file from database work local, but not on server
| From: | Jef Sullivan | Date: | Thu, 08 Jun 2006 13:36:12 +0000 |
| Subject: | RE: [PHP] file from database work local, but not on server | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-237606@lists.php.net to get a copy of this message | ||
What happens when you print out the query to the page?
Is the query correct?
Jef
-----Original Message-----
From: Peter Lauri [mailto:lists@dwsasia.com]
Sent: Wednesday, June 07, 2006 1:10 PM
To: php-general@lists.php.net
Subject: [PHP] file from database work local, but not on server
Best group member,
This code works fine on my local machine:
$Query = sprintf("SELECT * FROM filestorage WHERE id=%s LIMIT 1",
$_GET['fileid']);
$Result = mysql_query($Query);
if (mysql_num_rows ($Result)>0) {
$Row = @mysql_fetch_array ($Result);
$file_type = $Row["filetype"];
$file = $Row["filedata"];
header ("Content-type: $file_type");
header("Content-Disposition: attachment;
filename=fil".substr($Row['filename'], strrpos($Row['filename'],
'.')));
'.')).'"
print $file;
}
But when I run it on my server it does not start the download, and the
file
name is the location of the script instead of what I state as file name.
Is this a server issue? I run Linux server with Plesk. Is there anyone
with
the same problems?
Best regards,
Peter Lauri
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php