[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] RE: PHP uploading problem on RaQ3 fopen



Hi Yah,

Steve replied...

"That directory must be writable by httpd (the Apache user). That should solve your problem. If not, then let us know."

Steve,

The folder to which the script moves to image to:

Unable to move file from tmp.
./db_images/bouquets/test_heliconia.jpg/tmp/php0p0CsQ test_heliconia.jpg
 File open failed

Has had it's permissions changed to 666 and also 777, I've also changed ownership from the user allseaso to httpd to see if that made any difference. In the script I've also had the customer change the ./db_images/bouquets/test_heliconia.jpg to the full /home/sites/site99/db_images/bouquets/filename.jpg and still no joy.

The tmp folder on the server is root:root & chmod 777

I tried till the early hours of this morning playing with ownerships & chmoding but no joy - either I'm missing the obvious (which I probably am) or it could be the script but saying that it worked on another Redhat box.

Currently the set-up is:
The /web folder is owned by nobody 755
The db_images is owned by allseaso & 755
The bouquets folder is owned by allseaso & 777
All belong to the same group site99


Now the script being called from another folder ./maintain/bouquets/updateAction.php3
The script is owned by allseaso site99 & 777
The maintain folder being 755 site99 & allseaso
The bouquets folder is 755 site99 & allseaso

Here's a snippet from the actual code relevant to the upload part...

$file_query = "SELECT filename FROM bouquets WHERE filename='$userfile_name'"; $file_result = mysql_query($file_query, $mysql_access);
                                if(mysql_num_rows($file_result)) {
print("\nFile upload unsuccessful.\nThe selected filename already exists.\nPlease try again using another filename.");
                                        }
                                else {

if (move_uploaded_file($userfile,"/home/sites/site99/web/db_images/bouquets/".$userfile_name)) { } else { echo "Unable to move file from tmp.\n"."/home/sites/site99/web/db_images/bouquets/".$userfile_name; }
                                        $sfile = fopen($userfile,r);
                print("$userfile $userfile_name $sfile");
                                        if( $sfile ){

$dfile = fopen("ftp://username:password@xxxxxxxxxxxxxxx/db_images/bouquets/"; . $userfile_name ,w);
                                                if( $dfile ){
fwrite( $dfile, fread($sfile, filesize($userfile)));
                                                        fclose( $dfile ); }
                                                else{
print("\nFile open to FTP failed");
                                                }
                                                fclose( $sfile ); }
                                        else{
                                                print("\nFile open failed");
                                        }

The customer got back to me this more saying that the script isn't getting past the fopen part, but when the script is run the error message does show that it's created a file in tmp but it can't open it to move to the predefined folder in the customers hosting space. I don't want to have to tell him sorry can't help and end up loosing their business.

Is it a permission thing on the Cobalt?

Regards

Chae