use $params['fileid'] instead of $fileid