Photo Upload

liunx

Guest
I would like to change my photo gallery to allow photo uploads from relatives, etc. The problem is that if someone uploads a photo, it's then owned by the nobody user. I've been told this is not a good thing plus I know it isn't because then I can't move or delete the files later as "spolemn".<br /><br />I'd like the PHP script to upload the photo, resize the photo into another directory, and then change the ownership to "spolemn". How can I accomplish the final part? Is there a script/command I can exec() to do this?<!--content-->
<!--quoteo(post=179433:date=May 17 2006, 01:45 PM:name=DirkNiblick)--><div class='quotetop'>QUOTE(DirkNiblick @ May 17 2006, 01:45 PM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=179433"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->I'd like the PHP script to... change the ownership to "spolemn". How can I accomplish the final part? Is there a script/command I can exec() to do this?<!--QuoteEnd--></div><!--QuoteEEnd--><br />Unfortunately, there is no way for you to do this. Only the root user (i.e. the Help Desk) has the ability to change the owner of a file or directory. (This is a security restriction by the operating system.)<br /><br />You basically have two options here:<br /><br />1) Ask the Help Desk to change the ownership of uploaded files from "nobody" to your user ID every time one or more files are uploaded.<br /><br />2) Configure your script to run as CGI script. As a CGI script, your script would run under your user ID instead of "nobody", so any files uploaded and created by such a script would be automatically owned by you.<br /><br />You didn't say what script you were using for your photo gallery, so I don't know how feasible option #2 would be.<!--content-->
<!--quoteo(post=179435:date=May 17 2006, 03:01 PM:name=TCH-David)--><div class='quotetop'>QUOTE(TCH-David @ May 17 2006, 03:01 PM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=179435"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->1) Ask the Help Desk to change the ownership of uploaded files from "nobody" to your user ID every time one or more files are uploaded.<!--QuoteEnd--></div><!--QuoteEEnd--><br />well, maybe not <i>every</i> time you upload a photo<br /><br /><!--coloro:#999--><span style="color:#999"><!--/coloro--><i><b>*TCH-Tim</b> cringes at the thought of waking up to hundreds of tickets to change file ownership on pictures <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/blink.gif" style="vertical-align:middle" emoid=":blink:" border="0" alt="blink.gif" /></i><!--colorc--></span><!--/colorc--><!--content-->
Well, I guess I'll just have to leave them as owned by nobody. Thanks anyway.<!--content-->
<!--quoteo(post=179439:date=May 17 2006, 04:18 PM:name=DirkNiblick)--><div class='quotetop'>QUOTE(DirkNiblick @ May 17 2006, 04:18 PM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=179439"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->Well, I guess I'll just have to leave them as owned by nobody. Thanks anyway.<!--QuoteEnd--></div><!--QuoteEEnd--><br />I didn't say we <i>wouldn't</i> change ownership for you, I'm just asking that you batch your requests rather than open twenty tickets every day. I'm sure you can see my concern.<br /><br />What script are you using? Maybe we can help you come up with a different method.<!--content-->
It's a PHP photo gallery I've written. I want to allow my relatives to upload pictures into the directories. Like I said, there's nothing wrong with letting the nobody user do it until I want to move/delete files created that way. I suppose I could just send in a help desk ticket to chown the directory.<!--content-->
Why not use Coppermine as your gallery, then you shouldn't have any problems with ownership etc.<!--content-->
 
Back
Top