Jump to content

Archived

This topic is now archived and is closed to further replies.

kikilahooch

uploading images,says access is denied

Recommended Posts

I'm trying to upload images into my database, along with data on them. The values including the image name are being stored in the db but the image is not uploading. I have used the exact same code before but with a different hosting company. The message I am getting is:


Warning: move_uploaded_file(/home/groover/public_html/images/pure.jpg): failed to open stream: Permission denied in /home/groover/public_html/admin_insert.php on line 54

Warning: move_uploaded_file(): Unable to move '/tmp/phpudG2GY' to '/home/groover/public_html/images/pure.jpg' in /home/groover/public_html/admin_insert.php on line 54

Any idea what would cause this error??

[code]
<?php
//check for required fields from the form
if ((!$_POST[uname]) || (!$_POST[pword])) {
header("Location: adminlogin.html");
exit;
}

//connect to server and select database
$conn = mysql_connect("localhost", "groover", "dwde909") or die(mysql_error());
mysql_select_db("groover_walshy",$conn) or die(mysql_error());

//create and issue the query
$sql = "select *from admin where uname = '$_POST[uname]' AND pword = '$_POST[pword]'";
$result = mysql_query($sql,$conn) or die(mysql_error());

//get the number of rows in the result set; should be 1 if a match
if (mysql_num_rows($result) == 1) {

//if authorized, get the values of fname lname
$fname = mysql_result($result, 0, 'fname');
$lname = mysql_result($result, 0, 'lname');

//set authorization cookie
setcookie("auth", "1", 0, "/", "grooverecord.net", 0);

//create display string
$display_block = "<P>$fname $lname is authorized!</p>
<P>Authorized Users' Menu:
<ul>
//<li><a href=\"secretpage.php\">secret page</a>
</ul>";

} else {

//redirect back to login form if not authorized
header("Location: adminlogin.html");
exit;
}
header("Location: adminwelcome2.php? login=true&id=$uname");

exit();

?>
<HTML>
<HEAD>
<TITLE>User Login</TITLE>
</HEAD>
<BODY>
<? echo "$display_block"; ?>
</BODY>
</HTML>
[/code]

Share this post


Link to post
Share on other sites
Is the target folder for images write-enabled?

Share this post


Link to post
Share on other sites
I'm not sure, how do I check??? On the last hosting site I right clicked on images and changed the chmod or something but when I right click on this i cant do anything

Share this post


Link to post
Share on other sites
No idea. It depends on what tools your web host provides.  I change permissions on my sites through WS FTP.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.