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