nezbo Posted July 29, 2008 Share Posted July 29, 2008 Hi all I am uploading a file (image) and every time i upload one, it gives it the permitions of 0500 and the image is not viewable on the site. is there any way to change the permitions on the file as i upload it? Here is my code to far: <?php $dir = "./rideImages/" . $_REQUEST['rideid']; if (!is_dir($dir)) { mkdir ("./rideImages/" . $_REQUEST['rideid'] , 0777); } if ($_FILES["file1"]["size"] >= 250000) { echo "<div align='center'>" . $_FILES["file1"]["name"] . " is to large can not be uploaded.</div>"; } else if ($_FILES["file1"]["type"] != "image/pjpeg") { echo "<div align='center'>" . $_FILES["file1"]["name"] . " is not a .jpg file type and can not be uploaded.</div>b"; } else if ($_FILES["file1"]["type"] != "image/pjpeg") { echo "<div align='center'>" . $_FILES["file1"]["name"] . " is not a .jpg file type and can not be uploaded.</div>b"; } else if (move_uploaded_file($_FILES["file1"]["tmp_name"],"./rideImages/" . $_REQUEST['rideid'] . "/" . $_FILES["file1"]["name"])) { $theName = $_FILES["file1"]["name"]; $theDir = $dir . "/" . $_FILES["file1"]["name"]; $sql = "INSERT INTO rideimages (rideID, imagePath, userID) VALUES ('" . $_REQUEST['rideid'] . "', '".$theDir."', '".$_COOKIE['user']."')"; if (!@mysql_query($sql,$con)) { die('Error : ' . mysql_error()); } echo "<div align='center'><font size=\"1\" color=\"red\"><strong>File Name : " . $_FILES["file1"]["name"] . "<br>File Type : " . $_FILES["file1"]["type"] . "<br> File Size : " . ($_FILES["file1"]["size"]) / 1024 . "kb<br>Image uploaded.</strong></font></div>"; } } Quote Link to comment https://forums.phpfreaks.com/topic/117165-move_uploaded_file-permitions-help/ Share on other sites More sharing options...
ignace Posted July 29, 2008 Share Posted July 29, 2008 chmod(): http://be.php.net/manual/en/function.chmod.php Quote Link to comment https://forums.phpfreaks.com/topic/117165-move_uploaded_file-permitions-help/#findComment-602645 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.