query($query); //$row= mysql_fetch_array ($result); //$type = $row ["type"]; //$name = $row ["name"]; //$size = $row ["size"]; //$file_id = $row ["file_id"]; // get the file data $query = "select ID, Chunk from chunks where MediaUploadID='$currentID' ORDER by ID"; $result = mysql_query($query , $cnx); // decode the fragments and recombine the file $data = ""; while ($row = mysql_fetch_array($result)) { // $data .= base64_decode($row ["data"]); $data .= $row ["Chunk"]; } // output the file header ("Content-type: $mimetype"); header ("Content-length: $Size"); header ("Content-Disposition: attachment; filename=$Name"); header ("Content-Description: PHP Generated Data"); echo $data; exit; } else { //output the file in the traditional manner... header("Content-Disposition: attachment; filename=$Name"); header("Content-Type: $mimetype"); echo $rs[0]; exit; } ?>