file manipulation in PHP?

Questions about programming languages and debugging
Post Reply
User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

file manipulation in PHP?

Post by bad_brain »

hey folks... :wink:
are there methods to CHMOD/CHGRP/CHOWN files in PHP?
I´m establishing the upload script for users at the moment, the files are stored in a .tmp-file while uploading and then are moved to the target folder, and to be on the safe side I want to change the permissions of these files to an absolute minimum until they are checked....could be done by hand of course, but would be much more comfy if it´s done automaticly when moving the file.

User avatar
maboroshi
Dr. Mab
Dr. Mab
Posts: 1624
Joined: 28 Aug 2005, 16:00
18

Hello

Post by maboroshi »

Try This

an example

Code: Select all


chmod("/somedir/somefile", 644);

For CHMOD

http://ca.php.net/chmod

For CHGRP

http://www.phpdig.net/ref/rn22re293.html

for CHOWN

http://ca.php.net/chown

Cheers :)

User avatar
maboroshi
Dr. Mab
Dr. Mab
Posts: 1624
Joined: 28 Aug 2005, 16:00
18

Don't Know

Post by maboroshi »

Hey Bad Brain one thing to note uploading via http in PHP as far as I can tell from my research is there is a limit to the file size that the server sets by default (anyone correct me if I am wrong) the default size is usually around 7 mb

Just thought I would mention that ;)

Cheers Maboroshi

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Post by bad_brain »

thanks buddy... :D

I´ll have to check if there´s a max. upload size by the server settings, but I´ll limit the size by the upload script anyway (I´m also planning to allow specific file extensions only).

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Post by Gogeta70 »

Yes, there's a max, however, it's usually defined by the person writing the php script.
¯\_(ツ)_/¯ It works on my machine...

User avatar
maboroshi
Dr. Mab
Dr. Mab
Posts: 1624
Joined: 28 Aug 2005, 16:00
18

Yes Indeed

Post by maboroshi »

Yes but that max_file_size has to be less then the value in these server variables

# ile_uploads
# upload_max_filesize
# max_input_time
# memory_limit
# max_execution_time
# post_max_size

So You will have to check Your PHP Configuration file B_B

;)

Cheers Maboroshi

Post Reply