public function create_new($name, $location, $url) { # compute md5 sum of the data file $md5 = md5_file($location); # sign the md5 hash $sig = generate_signature($md5); # insert into database $name = mysql_escape_string($name); mysql_query("insert into file (name, md5, sig, url) " . "values(\"{$name}\", \"{$md5}\", \"{$sig}\", \"{$url}\")") or die("query to insert new file failed: " . mysql_error()); # return the object $new_id = mysql_insert_id(); return FlashFile::load_from_id($new_id); }