I am using a simple file upload form. The script below uses the variable $callName to rename the file with a unique number and attaches the file extension. It seems to be doing everything file, but when I go to view the image files the are all 1k and bring up a blank screen. Any suggestions? Here is my code:
// upload file
$path_to_file = 'data/uploads/';
$files = $HTTP_POST_FILES['files'];
//seperates extension from file name and discards file name
$name = $files['name'];
list ($tmpname, $ext) = explode(".",$name);
//combines $callName with extension ($ext) to create new, unique file name
$name = "$callName.$ext";
if (!ereg("/$", $path_to_file))
$path_to_file = $path_to_file."/";
// moves files to new location
$location = $path_to_file.$name;
print "<br>$location<br>";
while (file_exists($location))
$location .= ".copy";
copy($files['tmp_name'][$key],$location);
unlink($files['tmp_name'][$key]);
print "goit";