473,396 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

UNIX : upload file permission problem

Seb
Hi,

I've got something strange when uploading files on a UNIX machine with
PHP 4.3.4 + Apache 1.3.29 :

The uploaded file is uploaded in /va/tmp with permissions 600 (that's
normal)

move_uploaded_file move it into the destination directory and
permissions stay to 600 also it should be 640 because the UMASK is 027.

If destination directory is /tmp the uploaded file gets the right
permissions : 640 (according to the UMASK at 027).

Strange isn't it, do you have a clue ?

Thx,

Seb
Jul 17 '05 #1
2 3352
without getting into umask, why not chmod it after the move?

--
Mike Bradley
http://www.gzentools.com -- free online php tools
"Seb" <sc************@cegetel.net> wrote in message
news:c1**********@reader1.imaginet.fr...
Hi,

I've got something strange when uploading files on a UNIX machine with
PHP 4.3.4 + Apache 1.3.29 :

The uploaded file is uploaded in /va/tmp with permissions 600 (that's
normal)

move_uploaded_file move it into the destination directory and
permissions stay to 600 also it should be 640 because the UMASK is 027.

If destination directory is /tmp the uploaded file gets the right
permissions : 640 (according to the UMASK at 027).

Strange isn't it, do you have a clue ?

Thx,

Seb

Jul 17 '05 #2
Seb
I had to do it.

My point of view is :

PHP creates the temporary uploaded file with the minimum permission 600.

Then move_uploaded_file move the file in the destination directory.

If the temporary file and the destination file are in the same file
system, the permissions are not changed (same i-bode, as mv works)

If the temporary file and the destination file are in differents fille
systems, the UMASK is applied because PHP has to create a new i-node.

That's all I can imagine.

Seb

CountScubula wrote:
without getting into umask, why not chmod it after the move?

--
Mike Bradley
http://www.gzentools.com -- free online php tools
"Seb" <sc************@cegetel.net> wrote in message
news:c1**********@reader1.imaginet.fr...
Hi,

I've got something strange when uploading files on a UNIX machine with
PHP 4.3.4 + Apache 1.3.29 :

The uploaded file is uploaded in /va/tmp with permissions 600 (that's
normal)

move_uploaded_file move it into the destination directory and
permissions stay to 600 also it should be 640 because the UMASK is 027.

If destination directory is /tmp the uploaded file gets the right
permissions : 640 (according to the UMASK at 027).

Strange isn't it, do you have a clue ?

Thx,

Seb


Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: kafooey | last post by:
Hi all, I've been digging around on the newsgroups and the web for a possible answer for this problem, but have so far come up with nothing so thought I would ask here... I have the following...
3
by: Philippe Lemmerling | last post by:
I have a question concerning security of my file upload script. I'm using the php upload routines (move_uploaded_file,...) and variables ($_FILES) to upload images to a webdirectory. Everything...
0
by: SEMIH DEMIR | last post by:
Sitelerden birinde verilen yabancı kaynakli bir scriptti duzenledim yanlız birseyin içinden bir turlu cıkamadım işin aslı ilk defa persistin upload componentini kullanacam yanlız suanki haliyle...
1
by: igotyourdotnet | last post by:
Ok, here is the issue: I have 2 web pages one does a file upload to a database and the other page does a FTP to a server, both pages use the c:\temp directory. The page that uploads to a database...
9
by: Steve Poe | last post by:
I work for an animal hospital trying to use PHP to store an animal's dental x-rays to a file server. I can browse for the xray on the local desktop computer then click "Upload Image". This...
0
by: foekall | last post by:
I used this script and test on my hosting. Evertimes appear "change permission to 777 failed. ". So, how to solve this error. Please kindly check for me and teach me. <?php $MAX_SIZE =...
4
by: Tony B | last post by:
I've moved an existing site (which I didn't write) from a apache/php/mysql host under windows to a linux apache/php/mysql host. I've sorted out most problems except one. There is an upload...
1
wadro21
by: wadro21 | last post by:
i am trying to write a php uploader for a site and keep getting this error: Warning: move_uploaded_file(uploads61877494_tp.jpg) : failed to open stream: Permission denied in...
1
by: lPrentice | last post by:
Hello, After all this time, Linux file permissions still confuse me at times. I have a Python web-based application with an file (images) upload module. The application is running on two remote...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.