[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [cobalt-users] PHP uploading problem on RaQ3 fopen
- Subject: RE: [cobalt-users] PHP uploading problem on RaQ3 fopen
- From: "Si Watts" <simon@xxxxxxxxxxx>
- Date: Fri Jun 14 15:35:01 2002
- List-id: Mailing list for users to share thoughts on Sun Cobalt products. <cobalt-users.list.cobalt.com>
:> The customer has a mysql database set-up with PHP scripting, now
:> on one of
:> the pages they have a file upload routine, when the routine is
:> run we get
:> the following error...
:>
:> Unable to move file from tmp.
:> ./db_images/bouquets/test_heliconia.jpg/tmp/php0p0CsQ test_heliconia.jpg
:> File open failed
:>
:> No FrontPage so all folders in users ownership. Did see
:> somewhere that on
:> one of the Cobalt updates the /tmp folder changed and it's now a
:> sym link
:> which apparently Apache does like ? The other thing (be gentle just a
:> learner with PHP & MySQL) is I've checked the tmp folder which is really
:> /home/tmp and none of the files that we have tested has actually been
:> uploaded or gone into the tmp folder.
Having just accomplished all of this (and integration with ImageMagick :-) )
here's what I do.
(RaQ4i 256)
// <- REMOVE ANY SPACES FROM ORIGINAL FILENAME
$image=str_replace(" ", "", $image);
// <- Specify our desired filename for the saved image (add prefixes or
suffixes as necessary)
$saved_image="$image_name";
// <- Save the original to the filesystem
copy($image, $PHOTO_PATH.$saved_image);
// <- Dispose of original upload
unlink($image);
where $image is the field name for the file upload (ie the temp file)
where $PHOTO_PATH is the defined path (ie
/home/sites/siteXX/web/path/to/folder/ ) This target folder needs to be 777.
Ownership is irrelevant. I have this running on both FrontPage uploaded
sites AND FTP'd sites.
and $saved_image is a predetermined target filename for the uploaded image
PHP appears to automatically define array values for an uploaded image, so
if your upload field name is named "image" php automatically gets values
from $image and assigns them to $image_name, $image_size and $image_type
I'll make no claims to being a php expert but I have a fully functional
uploader with image resizing (via ImageMagick) running just perfectly on my
RaQ. Is it that your clients code is just a little bloated? Or is it that
your client is trying to MOVE instead of COPY? Mine copies the original and
then disposes of the original and it works without fail, every time.
HTH
Kind Regards
Si Watts
SiWIS http://www.siwis.co.uk