Hi All,
This is probably more of a PHP question, but I wonder if anyone here can help.
I have 2 php scripts - a form and a script file that is suposed to upload a file to a directory on my website. I'm pretty sure the code is OK, but the script dosen't work. Is there some security setting in SME 5.6 that might cause this? The target directory is a sub directory off wwwroot and has permissions set to 777 and is owned by Admin.
This is the form...
<html>
<head>
<title>Upload Form</title>
</head>
<body>
<form action="upload_file_script.php" enctype="multipart/form-data" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="51200">
File to Upload: <input type="file" name="fileupload"><br><br>
<input type="submit" value="upload!">
</form>
</body>
</html>
And this is the upload script...
html>
<head>
<title>File Upload Script</title>
<html>
<head>
<title>Upload script</title>
</head>
<body>
<h1>File Upload Results</h1>
<?php
$file_dir = "/Intranet/files";
foreach($_FILES as $file_name => $file_array) {
echo $file_dir;
print "<br>\n";
print "path: ".$file_array['tmp_name']."<br>\n";
print "name: ".$file_array['name']."<br>\n";
print "type: ".$file_array['type']."<br>\n";
print "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");
print "file was uploaded!<br><br>";
}
}
?>
</html>
Any ideas? Thanks in advance!
Dave