Re: copy_file() files
| From: | Ajai Khattri | Date: | Wed, 03 Dec 2003 21:47:53 +0000 |
| Subject: | Re: copy_file() files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171728@lists.php.net to get a copy of this message | ||
On Wed, Dec 03, 2003 at 03:06:50PM -0600, Jay Blanchard wrote:
> What is the chmod of those files/directories. Also, there is no
Well, the destination folder (as I stated) is owned by user nobody and group
nobody. Apache is running as user nobody and group nobody. And Im assuming that
any files written in /tmp by Apache are owned by user nobody and group nobody.
> copy_file() function listed at php.net...could this be a user built
> function? Or are you talking about http://www.php.net/copy ?
You're right - I changed the function to move_uploaded_file() which still
doesn't work either.
Here's a snippet of code (I have commented out passwords and database stuff
with X's:
01: <?
02: $keys = array_keys($HTTP_POST_VARS);
03: for($i=0;$i<=count($keys);$i++)
04: {
05: $temp = $keys[$i];
06: $HTTP_POST_VARS[$temp] = htmlentities($HTTP_POST_VARS[$temp]);
07: }
08:
09: $link = mysql_connect("localhost", "XXXXXXXX", "XXXXXXXXX") or
exit("could not connect to the database");
10: mysql_select_db("XXXXXXXXXXXXXXXXXXXX") or die("could not select database");
11: if($image == "")
12: {
13: unset($image_name);
14: }
15: else
16: {
17: move_uploaded_file($image, "/database/images/$image_name") or die("\nCannot move
image file to directory.\n(Tried copying $image to ../database/images/$image_name).");
18: chmod("../database/images/$image_name", 0777) or die("Cannot change file
permission for image.");
19: }
Line 17 generates the error message.
I also did some tests and verified that the temp. file in /tmp if owned by
user nobody and group nobody.
Is there a way to generate an actual system error message if it is a system
error?
--
Aj.
Sys. Admin / Developer