[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [cobalt-users] RE: PHP uploading problem on RaQ3 fopen
- Subject: RE: [cobalt-users] RE: PHP uploading problem on RaQ3 fopen
- From: "Si Watts" <simon@xxxxxxxxxxx>
- Date: Sat Jun 15 03:28:01 2002
- List-id: Mailing list for users to share thoughts on Sun Cobalt products. <cobalt-users.list.cobalt.com>
:> the only problem we have now is
:> that when the script moves it from the tmp folder it gives the file the
:> following permissions...
:>
:> filename.jpg rw....... httpd root
Well, I really don't know what causing that, because here's a sample of one
of mine once it's been copied into the target folder;
[root smsimg]# ls -al | more
total 1470
drwxrwxrwx 3 nobody site32 3072 Jun 15 01:23 .
drwxrwsr-x 14 nobody site32 1024 Jun 15 01:28 ..
-rw-r--r-- 1 httpd site32 20921 Jun 9 14:14 10quantumproc.jpg
AFAIK, there is no need to actually save the temp file to the local
filesystem. All I can assume is that because the /tmp folder is owned by
root, if the temp file is physically saved, it is adopting its group
ownerships and status (apologies, I really am not an expert so feel free to
correct me, I'm still learning myself) from its owned ststus in that folder,
such that the copied image retains those values.
I don't save my temp image to the filesystem, in fact the temp folder is
never actually declared. The code I gave in the last message (with other
bits snipped) is the first set of routines once the form has been submitted.
routine (no code):
if action is upload: (do the database stuff first, ie addition of text
fields etc to db, then requery to get the maxid)
strip spaces from uploaded image (this does work with a simple str_replace
run on the variable assigned for the file upload field
declare a target filename for the new image (because the majority of mine
are linked to db entries I actually use the id of the db entry -maxid from
previous routines and prepend it to the actual filename to create a unique
filename)
copy the temp image to the target location (full file system path needs to
be declared)
delete the original temp image from memory.
getImageSize on the new image in its target location and save the sizing
details and filenames back against the record in the db.
If necessary contact me off-list and I'll give you an full example of the
code (as said previously, I have it integrating with ImageMagick o my server
and it works a treat)
Kind Regards
Si Watts
SiWIS http://www.siwis.co.uk