Re: file creation: ownership
- From: "Jonathan Mcdougall" <jonathanmcdougall@xxxxxxxxx>
- Date: 22 Aug 2005 23:51:19 -0700
Colin McKinnon wrote:
> Jonathan Mcdougall wrote:
>
> >
> >> Maybe the best option is to look at why you think you need to create a
> >> file owned by the ftp account which you didn't really explain in your
> >> post.
> >
> > I am hosting a blog on which I can upload pictures. Uploading is done
> > in two parts: first an applet uploads the picture by ftp and then a php
> > script creates thumbnails with GD. The java applet is fine (uses ftp,
> > of course) but the php script (gd) creates file having the owner
> > 'apache'. There is the problem.
> >
>
> Nope, I don't get why this is a problem - unless PHP can't access the images
> becuase the FTPd is also set to save files 0600 (is chmod in ftp disabled
> too?).
For each image sent by the user, I keep two on the server. The first is
sent by the java applet (using FTP) and is the original version. It it
saved in a folder and I have no problem with this file (I am the owner,
at least 0644).
The java applet then refreshes the page and a PHP script kicks in. It
finds the newly uploaded images and creates thumbnails with gd. These
files are saved in the same folder. These are the problematic files:
the owner is 'apache' and they are 0600.
Accessing the first (uploaded by applet/FTP) images is fine.
Accessing the thumbnails (created by PHP) does not work, as if the
image were non existent. Asking the hosting company to modify the
permissions of these files to 0644 makes the images load fine.
> > An obvious solution would be to have the java applet making the
> > thumbnail, but I would like to keep the current setup (a pain to
> > modify).
> >
>
> Sounds like the problem is the permissions with the ftpd which you're trying
> to fix from PHP.
No. Two different files are created. The first one by FTP is fine and
the second one by PHP is wrong.
What's more, if I do something like
<?php
$i = createimage(1, 1);
createjpeg($i, "test");
?>
on a test page, the "test" file is owner by 'apache' and is 0600
(rw-------).
> quick suggestions:
>
> 1) upload the file using HTTP (ftp is just BAD anyway)
I can't. Several (unlimited, but usually 15-20) jpeg pictures, usually
around 200k each. Impossible with the current server settings (max
upload particularily) and 20 text boxes with browse buttons are not
quite user-friendly.
> 2) upload the file to a temporary area using ftp then have you PHP file scan
> the area for new files and copy them (with the permissions of the
> webserver) to the 'live' area.
Hmm.. That seems good, but how would that solve the problem? And I need
to create a thumbnail. How could that 'temporary area' solve the
problem?
Jonathan
.
- References:
- file creation: ownership
- From: jonathanmcdougall
- Re: file creation: ownership
- From: Colin McKinnon
- Re: file creation: ownership
- From: Jonathan Mcdougall
- Re: file creation: ownership
- From: Colin McKinnon
- file creation: ownership
- Prev by Date: Re: mail: php.ini setup
- Next by Date: Re: Cookie is in a cache?
- Previous by thread: Re: file creation: ownership
- Next by thread: php 5.04 with apache 2.0.54
- Index(es):