Hello anyone...
I have put together a script that I have taken from a book to create a simple file transfer page to my site.
I have a simple html upload form that calls the following script, but it doesn't work.
Can anyone see anything glaringly obviously wrong with it, or suggest what I might be doing wrong..
am tearing my hair out...
<html>
<head>
<title>Listing 9.14 a file upload script</title>
</head>
<body>
<h1>File Upload results</h1>
<?php
$file_dir = "/web/702/public_html/uploads";
foreach($_FILES as $file_name => $file_array) {
echo "path: ".$file_array['tmp_name']."<br>\n";
echo "name: ".$file_array['name']."<br>\n";
echo "type: ".$file_array['type']."<br>\n";
echo "size: ".$file_array['size']."<br>\n";
if (is_uploaded_file($file_array['tmp_name'])) {
move_uploaded_file($file_array['tmp_name'],
"$file_dir/$file_array[name]") or die ("couldn't copy");
echo "file was moved!<br><br>";
}
}
?>
</body>
</html>