chmod() problems
Posted: Sun Feb 06, 2005 12:13 pm
Hi! I have a code that uploads a picture to the server, and then I need to chmod it to 777. It is uploaded at 644 by default. The problem is, when I run the chmod() command, the file permission becomes 1411, which is just nonsense. I'm guessing the last digit is ignored, but anyway. What can I do? Below is the upload code:
Sorry, I really hate the output of the<?php
//...
if ($_FILES['pic'.$i]['name']!=""){ //if there was input
$info = @getimagesize($_FILES['pic'.$i]['tmp_name']);
if ($info[2]==2) {
if (move_uploaded_file($_FILES['pic'.$i]['tmp_name'], "../pics/".$album_name."/".$_FILES['pic'.$i]['name'])){
chmod("../pics/".$album_name."/".$_FILES['pic'.$i]['name'], 0777);
mysql_query("INSERT INTO `pictures` (`url`, `album`, `date`) VALUES ('/pics/".$album_name."/".$_FILES['pic'.$i]['name']."', '".$album."',".$date.")", $db) or die (mysql_error());
}
else { die("Cannot upload file"); }
}
else{
die ("ALL PICS MUST BE .JPG or .JPEG! Please go back and fix it");
}
}
//...
?>
Code: Select all
tags.
Thanks!