Ask a Question related to PHP Development, Design and Development.
-
Bix #1
chown / chgrp of a http owned file after upload
Hiya,
I have written as part of my CMS, an image upload system, now when the
images are placed in the destination folder, they are owned by httpd.root
and I need to get them to be owned by siteuser.sitegroup.
I have tried to chmod and chgrp it to siteuser.sitegroup but it gives
permission denied errors.
Is there any way round this without enabling run as root? Or is there a safe
way to do this?
Thanks.
Bix Guest
-
HTTP File upload ...
Is there any http file upload component with Pause/Resume/Abort along with Progress Bar? Thank you, Regards, Raj. -
#39648 [NEW]: Implementation of PHP functions chown() and chgrp() not thread safe.
From: wharmby at uk dot ibm dot com Operating system: Linux RHEL4 PHP version: 5CVS-2006-11-27 (snap) PHP Bug Type: ... -
upload xml file to http with certificate?
Hi, I spent the last week looking for an answer to the following question: How can you upload an xml file to an HTTPS server with a specific... -
File.chown removes setuid permission
> non- does chown; non- indi- Thanks Daniel. This not only answers my question, but brings to my notice the mysterious lack of man2 manual... -
HTTP File Upload Using SSL
There are numerous methods of uploading files using HTTP. Is all that's necessary to get secure file upload would to reference a web page containing... -
Adrian #2
Re: [PHP] chown / chgrp of a http owned file after upload
you could setup a cronjob running as root which chowns the files.
or maybe you can so something with sudo
------------------------
--
Adrian
mailto:adrian@planetcoding.net
www: [url]http://www.planetcoding.net[/url]
www: [url]http://www.webskyline.de[/url]
Adrian Guest
-
Bix #3
Re: [PHP] chown / chgrp of a http owned file after upload
Not sure about cron, but will look into sudo.
Thanks!
"Adrian" <adrian@planetcoding.net> wrote in message
news:622461083.20030806132548@planetcoding.net...> you could setup a cronjob running as root which chowns the files.
> or maybe you can so something with sudo
>
>
>
>
> ------------------------
> --
> Adrian
> mailto:adrian@planetcoding.net
> www: [url]http://www.planetcoding.net[/url]
> www: [url]http://www.webskyline.de[/url]
>
>
Bix Guest
-
Mike Migurski #4
Re: [PHP] chown / chgrp of a http owned file after upload
>I have written as part of my CMS, an image upload system, now when the
You can ch(mod|own|grp) the files in the upload script, right after they>images are placed in the destination folder, they are owned by httpd.root
>and I need to get them to be owned by siteuser.sitegroup.
>
>I have tried to chmod and chgrp it to siteuser.sitegroup but it gives
>permission denied errors.
>
>Is there any way round this without enabling run as root? Or is there a
>safe way to do this?
are written to disk. chmod a+rwX is a good option if you are not overly
concerned about the security of these files. Are you getting
permission-denied errors when attempting to do this in your script, or
afterwards, on the command-line?
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca [url]http://mike.teczno.com/contact.html[/url]
Mike Migurski Guest
-
Bix #5
Re: [PHP] chown / chgrp of a http owned file after upload
This is the part of the code as it stands, it gives a permission denied
error.
$imtemp=$_FILES['file']['tmp_name'];
$imsize=$_FILES['file']['size'];
$imname=$_FILES['file']['name'];
if ($imsize > "100000") {zerror("Image too large","Please go back and
correct, image must be less than 100k"); unlink ($imtemp);}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/zeus_images/" .
$_POST['folder'] . "/" . $imname)){zerror("File already exists","The
filename $imname is already used"); unlink ($imtemp);}
if (move_uploaded_file($imtemp,$_SERVER['DOCUMENT_ROOT'] . "/zeus_images/"
.. $_POST['folder'] . "/" . $imname)){
if (chown($_SERVER['DOCUMENT_ROOT'] . "/zeus_images/" . $_POST['folder']
.. "/" . $imname, $site_user) && chmod($_SERVER['DOCUMENT_ROOT'] .
"/zeus_images/" . $_POST['folder'] . "/" . $imname,0644) &&
chgrp($_SERVER['DOCUMENT_ROOT'] . "/zeus_images/" . $_POST['folder'] . "/" .
$imname,$site_group)){
message ("file uploaded","File Uploaded!","File successfully uploaded
as $imname to folder " . $_POST['folder']);
}
else {
unlink ($_SERVER['DOCUMENT_ROOT'] . "/zeus_images/" . $_POST['folder'] .
"/" . $imname);
zerror("File CHMOD / CHOWN / CHGRP error");
}
}
else {
zerror ("File Upload Error");
}
"Mike Migurski" <mike@saturn5.com> wrote in message
news:Pine.GSO.4.52.0308061021310.2596@atari...>> >I have written as part of my CMS, an image upload system, now when the
> >images are placed in the destination folder, they are owned by httpd.root
> >and I need to get them to be owned by siteuser.sitegroup.
> >
> >I have tried to chmod and chgrp it to siteuser.sitegroup but it gives
> >permission denied errors.
> >
> >Is there any way round this without enabling run as root? Or is there a
> >safe way to do this?
> You can ch(mod|own|grp) the files in the upload script, right after they
> are written to disk. chmod a+rwX is a good option if you are not overly
> concerned about the security of these files. Are you getting
> permission-denied errors when attempting to do this in your script, or
> afterwards, on the command-line?
>
> ---------------------------------------------------------------------
> michal migurski- contact info and pgp key:
> sf/ca [url]http://mike.teczno.com/contact.html[/url]
>
Bix Guest



Reply With Quote

