grim918
December 23rd, 2005, 06:40 AM
im trying to set up a php script that will allow users to upload files on to my server. everytime that i try to upload a file from another computer on to the server i get an error saying that i dont have permission to write to the specified directory. can anyone help me out on how i can change the php script to allow user uploads.
here is my simple php upload script:
<?php
$file_dir = "/directory path//";
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 />";
}
}
?>
thanks to anyone that can help me out.
here is my simple php upload script:
<?php
$file_dir = "/directory path//";
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 />";
}
}
?>
thanks to anyone that can help me out.