problems with donwload



Under the results there are 3 files to download. Some users are getting an
uable to read or corrupt message.

http://vps.aztechost.co.uk/~trisco/index.php


and 3 here

http://vps.aztechost.co.uk/~trisco/rankings.php


The upload script is similar


if(isset($_POST['_upload']) && $_FILES['userfile']['size'] > 0)
{


$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];

$fp = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);

if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}


$id= $_POST['id'];
/*$query = "UPDATE results SET title='$title', file_name='$fileName',
size='$fileSize', type='$fileType', content='$content',
last_updated=CURDATE() WHERE id=$id";*/

$query ="INSERT INTO results (title, content, file_name, size, type,
last_updated) VALUES ('$title', '$content', '$fileName', '$fileSize',
'$fileType', CURDATE())";

mysql_query($query);
echo mysql_error();

}


and the download....

<?php
if(isset($_GET['id']))
{
// if id is set then get the file with the id from database
include("/home/trisco/public_html/secure/scripts/connect.php");

$id = $_GET['id'];
$query = "SELECT file_name, type, size, content FROM results WHERE id =
'$id'";

$result = mysql_query($query) or die(mysql_error());;
list($file_name, $type, $size, $content) =
mysql_fetch_array($result);

/*echo $file_name;
echo $type;
echo $size;*/


header("Content-Type: $type");
header("Content-Disposition: attachment; filename=$file_name");
header("Content-Length: ".filesize($file));
header("Accept-Ranges: bytes");
header("Pragma: no-cache");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-transfer-encoding: binary");

echo $content;
exit;

}

?>


I can open them on my desktop and laptop. Any clue why this is happening?
Permissions?


Thanks,


R.
.



Relevant Pages

  • Re: converter tool to convert from office 2007 to previous version
    ... The last thing I'm going to attempt is to download the office 2007 trial on ... Echo [MS PPT MVP] http://www.echosvoice.com ... in order for the converter to work, ...
    (microsoft.public.office.misc)
  • Re: cannot open .pps email attachment
    ... "Echo S" wrote: ... What's new in PPT 2007? ... Fixing PowerPoint Annoyances http://tinyurl.com/36grcd ... I can neither open nor download these ...
    (microsoft.public.office.misc)
  • Re: Suse DVD guide
    ... # 1) download the sources needed to build libdvdcss2 RPM ... # 3) Build the binary RPM packages and install it. ... echo "Checking if you have basic compiler and utils installed ..." ...
    (alt.os.linux.suse)
  • Re: How to remove update
    ... rem Kills the runonce to prevent error message from being popped up in ... echo Press any key when ready to process ES650 or CTRL-C to quit ... >> installing it, it takes 5 ... > "If you download the tool from the Windows Update Web site, ...
    (microsoft.public.win2000.windows_update)
  • Re: how do I tell a browser the name of a file, for download, if the file has open space in its name
    ... I have a download script, so customers on the website can download ... if ($fileToBuy) { ... echo "Sorry, but we can not find a file named '$fileToBuy' at ... it was an HTTP header issue. ...
    (comp.lang.php)