Page 1 of 1

Apache needed for mysql image upload????

Posted: Tue Apr 22, 2003 1:31 pm
by reverend_ink
OK guys, having a WIERD error...

Trying to build a script to upload images to a server along with a description...

But getting

Warning: Unable to create '/home/httpd/vhosts/site1/httpdocs/images/fans/': Is a directory in /home/httpd/vhosts/site1/httpdocs/admin/admin.php on line 61

Warning: Unable to move '/tmp/phpIh7va1' to '/home/httpd/vhosts/site1/httpdocs/images/fans/' in /home/httpd/vhosts/site1/httpdocs/admin/admin.php on line 61

Warning: Access denied for user: 'apache@localhost' (Using password: NO) in /home/httpd/vhosts/site1/httpdocs/admin/admin.php on line 69

Warning: MySQL Connection Failed: Access denied for user: 'apache@localhost' (Using password: NO) in /home/httpd/vhosts/site1/httpdocs/admin/admin.php on line 69
Unable to connect!

Here is the code I am using to determine if this is a new update

Code: Select all

@mysql_connect($host, $loginname, $password) or die(mysql_error()); 
@mysql_select_db($db) or die('Could not select database<br />'.mysql_error()); 


if ($_SERVER&#1111;'REQUEST_METHOD']=='GET')&#123;

?>
Then if there has been no update done they get a form...

But on submit this is the code I am trying to use

Code: Select all

<?
&#125; else &#123;
$tmp_loc=$_FILES&#1111;'pic']&#1111;'tmp_name'];
$name=$_FILES&#1111;'pic']&#1111;'desciption'];
move_uploaded_file($tmp_loc, "/home/httpd/vhosts/site1/httpdocs/images/$directory/$name");

$errorList = array();
$count = 0;

if (!$tmp_loc) &#123; $errorList&#1111;$count] = "Invalid entry: File"; $count++; &#125;

if (sizeof($errorList) == 0) &#123;
$connection = mysql_connect() or die ("Unable to connect!");
mysql_select_db($db) or die ("Unable to select database!");

$query = "INSERT INTO image(pic) VALUES('$pic', NOW())";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());

echo "<font size=-1>Added successfully.</font>";

mysql_close($connection);
&#125; else &#123;
echo "<font size=-1>The following errors were encountered: <br>";
echo "<ul>";
for ($x=0; $x<sizeof($errorList); $x++)
&#123;
echo "<li>$errorList&#1111;$x]";
&#125;
echo "</ul></font>";
&#125;
&#125;
?>
And yes dir has been chmod to 777

Thanks

Posted: Wed Apr 23, 2003 2:49 am
by herod1
OK I don't know how helpful this is but i saw that nobody else answered so I shall at least try to provoke thought.

The first error maybe because you do not have permissions to create directories on your server.

The second error is related to the first.

The third error is usually because you have a wrong username or password being sent.

The fourth is because of the third.

I hope it helps.