aaa
<html>
<head><title>up.html</title></head>
<body>
<form method="post" enctype="multipart/form-data" action="up.php">
updir(Remote):
<input type="text" name="updir"><BR>
localdir(Localdir):
<input type="text" name="localdir"><BR>
upfile:
<input type="file" name="upfile"><BR>
Mode(例:0700):
<input type="text" name="filemode"><BR>
<input type="submit" value="アップロードする">
</form>
</body>
</html>
<html>
<head><title>up.php</title></head>
<body>
<p> file uploader </p>
<?php
// $updir = "./upload/";
$updir = $_POST['updir'];
$filename = $_FILES['upfile']['name'];
$filemode = $_POST['filemode'];
print("updir:");
print("$updir </br>");
print("filename:");
print("$filename </br>");
print("filemode:");
print("$filemode </br>");
if (move_uploaded_file($_FILES['upfile']['tmp_name'], $updir.$filename) ==
FALSE){
print("Upload failed");
print($_FILES['upfile']['error']);
}
else {
print("<b> $filename </b> uploaded");
// print("<b> $filemode </b> change moded");
// chmod("/somedir/somefile", 0755); // 8 進数; 正しいモードの値
if (chmod($updir.$filename, $filemode ) == FALSE){
print("chmod failed");
}
else {
print("<b> $filemode </b> change moded");
}
}
?>
</body>
</html>
aaa