here you set data to the file contents
$data = fread($fp, filesize($path));
here you overwrite data with the pathname
$data = addslashes($path);
so you should concatenate if you really want to add the path to the file...
$data .= addslashes($path);
are you trying to addslashes to the content ? in which case you should be ..
$data = addslashes($data);