Jump to content
Sign in to follow this  
longtex

How to chmod() or chown()?

Recommended Posts

longtex

This is an outgrowth from http://www.autoitscript.com/forum/index.php?showtopic=99684 which referenced specifically ftp() functions.

I'm almost done with a little app that ftp-uploads a scanned file and an accompanying paramaters file to a Joomla! web server. The parameters are read by a bit of PHP code inserted in the top level of Joomla! and a new article is written, which includes a link to the scanned file. This allows clerks to create content simply by dropping a document in their scanner - the scanner driver & software (ScanDall) saves the scanned document and kicks off my app, which lets the clerk pick a target area and enter a short description... and voila! fresh scanned content, in seconds.

It works fine, with one small problem: the ftp'ed files are owned by the uploader and not by "www-data", which is the Apache user who runs the web site; the file attributes allow only the owner to access the files, so until we manually change either the owner or the attributes, Joomla! doesn't have access to the file. I'd love to just change the attributes the ftp server saves the files under, but so far none of the umask fiddling has worked. I wouldn't mind it if www-data could be used as the ftp user, but that also seems to be not possible (at least, not without serious security comppromises).

Maybe there's a better way to upload the file... but right now, I'd settle happily for just being able to chmod or chown it, since that works perfectly when it's done manually. I know this is possible, since the GUI FTP clients I've looked at (I use Total Commander) have the chmod feature builtin, and it works!


Nobody needs a job. Not much, anyway. Before you need a job, there's a lot of other stuff you need. More or less in order of how badly you need them: AIR, WATER, FOOD, SHELTER, CLOTHING, COMPANIONSHIP, and ACTIVITY. You've been led to believe you need money to "pay" someone else to provide those for you - all but AIR, so far. How long is it going to be before you have to "pay" for AIR, too?

Share this post


Link to post
Share on other sites
longtex

S O L V E D

It turns out that the proper FTPCommand string is not just "chmod 666 filename", but "quote site chmod 666 filename"

I'm not 100% sure this works with autoit, because the source of that information was talking about VB and the (presumably) selfsame "FTPCommand()" as found in wininet.dll

Let's just see about that.

Change the string and lose the WORD "quote", and it works. I'm not sure why the cli ftp was happy with the WORD, but at this point I don't friggin' CARE. Hah!

To recap: $result = _ftpcommand($connex,"site chmod 666 myfile.name") works like a champ.


Nobody needs a job. Not much, anyway. Before you need a job, there's a lot of other stuff you need. More or less in order of how badly you need them: AIR, WATER, FOOD, SHELTER, CLOTHING, COMPANIONSHIP, and ACTIVITY. You've been led to believe you need money to "pay" someone else to provide those for you - all but AIR, so far. How long is it going to be before you have to "pay" for AIR, too?

Share this post


Link to post
Share on other sites
ikaros

$result = _ftpcommand($connex,"site chmod 666 myfile.name") works like a champ.

Hi guys, this does not work for me....

I took the Ftp Command from the previous post and launched my FTP command with quote and without it, it always return 12003.

Somewhere it says 12003 is not an error, but i dont see the file's permissions change...

HELP!!!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×