I am trying to write a file upload/download site for fileshareing. I upload the files in a form using POST, ENCTYPE="mulitpart/form-data" , and INPUT TYPE="file". What is happening is that when I copy the file over to a directory that I use to quarenteen new files, and reassign the original filename then try to view , untar, or unzip the file I get an error saying that it is not of the expected type. ie. on a gzip file :
[user@host quarenteen]# gunzip foo.gz
gunzip:: foo.gz: not in gzip format
I am using the following code to copy the file from temp to the directory:
if(copy($userfile, "$quarenteen"."$userfile_name")){
#Change The File Permissions to deny execution
#
chmod("$quarenteen"."$userfile_name", 0644);
#Give a success message
#
echo "File Name: $userfile_name<BR>";
echo "File Size: $userfile_size<BR>";
echo "Transfer Succsefull";
}
#If the File cannot be copied...
#
else{
#Give an error if it did not work
echo "Failed to copy the File";
}
the above code is in a function because I roll through several uploads in the script. If anyone can help or tell me what I am doing wrong I would greatly appreciate it.
Thank you,
Alfred