Hello,
I am creating a file storage system for a web application. What I am doing is storing the name, size, and type in a database, and storing the data itself in the root directory tree. I do not keep the file extensions on these files in the tree, they are given a random 12-letter name (2l3j4234j343). However, after I collect the data from the form and write it, it is not an exact copy. The file becomes larger and slightly different from the original.
function uploadFile($formData) {
$data = addslashes(fread(fopen($formData, "r"), filesize($formData)));
$this->writeBinData("000000000000",$data);
}
function writeBinData($filehash,$data) {
$handle = fopen("../filebin/" . $filehash,"a");
fwrite($handle, $data);
}