[function.mkdir]: Permission denied warning
Posted: Thu Jul 30, 2009 1:16 am
here's the code i tested in a windows WAMP server and it was working fine without any warnings or errors. But when i hosted my site on a live online unix server i got a couple of errors.
here's the code
here's the list fo errors
Warning: mkdir(hhh111122) [function.mkdir]: Permission denied in /home/wwwgodn/public_html/old/imagealbum/add.php
Warning: move_uploaded_file(hhh111122/hhhh.zip) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/wwwgodn/public_html/old/imagealbum/add.php
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php5cIcOL' to 'hhh111122/hhhh.zip' in /home/wwwgodn/public_html/old/imagealbum/add.php
Warning: chmod() [function.chmod]: No such file or directory in /home/wwwgodn/public_html/old/imagealbum/add.php
Warning: unlink(hhh111122/hhhh.zip) [function.unlink]: No such file or directory in /home/wwwgodn/public_html/old/imagealbum/add.php on line 219
Please some help me its really urgent.
here's the code
Code: Select all
<?php
@session_start();
set_include_path("." . PATH_SEPARATOR . get_include_path());
require 'ArchiveExtractor.class.php';
// database code
$dbh=mysql_connect ("localhost", "root",
"") or die('Cannot connect to the database because: ' . mysql_error());
mysql_select_db ("wwwgodn_godnels");
//echo "Connection Successfull";
$sql="SELECT fldUsername FROM tblusers where fldUsername='".$_POST["txtusername"]."'";
$result = mysql_query($sql) or die("Query to get blah failed with error: ".mysql_error());
//echo"query";
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
include "adderror.html";
exit(1);}
mysql_free_result($result);
$rs = @mkdir( $_POST["txtusername"], 0777 );
//echo "make directory sucessfull";
if ((($_FILES["file"]["type"] == "image/gif")|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "application/x-rar-compressed")|| ($_FILES["file"]["type"] == "application/rar")
|| ($_FILES["file"]["type"] == "application/octet-stream")|| ($_FILES["file"]["type"] == "application/zip")
||($_FILES["file"]["type"] == "application/x-zip-compressed")||($_FILES["file"]["type"] == "application/octet-stream")
||($_FILES["file"]["type"] == "application/x-compress")||($_FILES["file"]["type"] == "application/x-compressed")
||($_FILES["file"]["type"] == "multipart/x-zip")|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 2000000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
//echo "Upload: " . $_FILES["file"]["name"] . "<br />";
//echo "Type: " . $_FILES["file"]["type"] . "<br />";
//echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
//echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
if (file_exists($_REQUEST["txtusername"]. "/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{move_uploaded_file($_FILES["file"]["tmp_name"],
$_REQUEST["txtusername"]."/" . $_FILES["file"]["name"]);
//echo "Stored in: " . $_REQUEST["txtusername"]."/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
if ((($_FILES["file"]["type"] == "application/zip")
|| ($_FILES["file"]["type"] == "application/rar")
|| ($_FILES["file"]["type"] == "application/zip")
||($_FILES["file"]["type"] == "application/x-zip-compressed")
||($_FILES["file"]["type"] == "application/octet-stream")
||($_FILES["file"]["type"] == "application/x-compress")
||($_FILES["file"]["type"] == "application/x-compressed")
||($_FILES["file"]["type"] == "multipart/x-zip")
|| ($_FILES["file"]["type"] == "application/octet-stream")))
{
$archExtractor=new ArchiveExtractor();
$extractedFileList=$archExtractor->extractArchive($_REQUEST["txtusername"]."/" . $_FILES["file"]["name"],$_REQUEST["txtusername"]."/");
chmod($_POST["txtusername"]."/" . $_FILES["file"]["name"],0777);
unlink($_POST["txtusername"]."/" . $_FILES["file"]["name"]);
echo "<h4 align='center'>album submitted</h4>";
}
$sql="Insert Into tblusers (fldUsername,fldPassword) Values ('".$_POST["txtusername"]."','".$_POST["txtpassword"]."')";
$result = mysql_query($sql) or die("Query failed with error: ".mysql_error());
mysql_close($dbh);
include "list1.php";
?>Warning: mkdir(hhh111122) [function.mkdir]: Permission denied in /home/wwwgodn/public_html/old/imagealbum/add.php
Warning: move_uploaded_file(hhh111122/hhhh.zip) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/wwwgodn/public_html/old/imagealbum/add.php
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php5cIcOL' to 'hhh111122/hhhh.zip' in /home/wwwgodn/public_html/old/imagealbum/add.php
Warning: chmod() [function.chmod]: No such file or directory in /home/wwwgodn/public_html/old/imagealbum/add.php
Warning: unlink(hhh111122/hhhh.zip) [function.unlink]: No such file or directory in /home/wwwgodn/public_html/old/imagealbum/add.php on line 219
Please some help me its really urgent.