move_uploaded_file destination string missing delimiter

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
mophilly
Forum Newbie
Posts: 1
Joined: Wed Nov 26, 2008 5:22 pm

move_uploaded_file destination string missing delimiter

Post by mophilly »

When I attempt to upload a file, PHP raises this error:

Code: Select all

SYSTEM WARNING: move_uploaded_file(/opt/mantis/uploads36eed9c6b5deeaaf696fb9cbf1a7a636): failed to open stream: Permission denied
 
SYSTEM WARNING: move_uploaded_file(): Unable to move '/tmp/phpiV06Ye' to '/opt/mantis/uploads36eed9c6b5deeaaf696fb9cbf1a7a636'
Note the destination string. I believe it missing the trailing slash after the word "uploads", e.g.
'/opt/mantis/uploads/36eed9c6b5deeaaf696fb9cbf1a7a636'

In the Apache <directory> directive I have the following php value assignments:

Code: Select all

php_admin_value open_basedir /opt/mantis/:/tmp/
php_admin_value upload_tmp_dir /opt/mantis/uploads/
In php.ini, uploads are enabled, the max file size is 50M, and memory limit is 64MB. The "mantis" settings are agreeable with the php.ini. The "uploads" directory is set to 776 (drwxrw-rw)

What do I need to adjust and/or learn to resolve this?

TIA.
nnnpuri
Forum Newbie
Posts: 14
Joined: Tue Nov 25, 2008 6:50 am

Re: move_uploaded_file destination string missing delimiter

Post by nnnpuri »

// File Upload Valditation...

if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/bmp")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 20000))
{
if ($_FILES["file"]["error"] >20000)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{


if (file_exists("D:/Training/12.11.08/images/" . $_FILES["file"]["name"]))
{


$now = time();

$path_parts = pathinfo($_FILES["file"]["name"]);
$string="naresh";
$newtry=$path_parts['basename'].$string;

$imagestring=$_FILES["file"]["name"];
$shuffled = str_shuffle($imagestring);

move_uploaded_file($_FILES["file"]["tmp_name"],
"D:/Training/12.11.08/images/" .$newtry.$now.$shuffled.$_FILES["file"]["name"]);
echo "Image Stored in: " ."D:/Training/12.11.08/images/"."<br>".$newtry.$now.$shuffled. $_FILES["file"]["name"];
}

else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"D:/Training/12.11.08/images/" . $_FILES["file"]["name"]);
echo "Image Stored in: " ."D:/Training/12.11.08/images/"."<br>". $_FILES["file"]["name"];
}
}
}

else
{
//echo "Invalid file"."<br>";
$infileerror="invalid file";
}
User avatar
airy
Forum Newbie
Posts: 20
Joined: Fri Jul 11, 2008 2:53 am

Re: move_uploaded_file destination string missing delimiter

Post by airy »

Please check this :
'/opt/mantis/uploads36eed9c6b5deeaaf696fb9cbf1a7a636'

Suppose to be

'/opt/mantis/uploads/36eed9c6b5deeaaf696fb9cbf1a7a636'

What's more : You should make sure directory /opt and /opt/mantis is accessable too
nnnpuri
Forum Newbie
Posts: 14
Joined: Tue Nov 25, 2008 6:50 am

Re: move_uploaded_file destination string missing delimiter

Post by nnnpuri »

you may have write wronge path to store file
Post Reply