473,566 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_f ile 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 3362
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.imag inet.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_f ile 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_f ile 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.imag inet.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
3554
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 code doing a file upload... $upload_result =
3
7844
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 works fine, meaning that I can upload images BUT only if I change the permission of the directory to which the uploaded images are moved to 777. I...
0
4742
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 verdiği hata şu.Bilen arkadaşlar lütfen yardım edin Persits.Upload.1 error '800a0020' The system cannot find the path specified. ...
1
3264
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 works fine, the page that FTP's the files returns me an error (Access denied filename.txt) Now the asp.net ID has full control of the c:\temp...
9
3880
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 works fine. The doctors want fewer steps to follow. So, it was asked if I can configure the browser to load/submit the image 'xray.tif' each time they...
0
1772
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 = 2000000;
4
10540
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 function on the site, which uploads files via POST to temp folder and then moves it into a folder on the host using php function move_uploaded_file. Under...
1
1818
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 /home/mysite/public_html/login/upload.php on line 5 Warning: move_uploaded_file() : Unable to move '/tmp/phpKlOJBh' to 'uploads61877494_tp.jpg' in...
1
1884
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 servers and a local server on my development network. The upload module works just fine when I'm uploading to my remote servers. But when I try...
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8108
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7644
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7951
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5484
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2083
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.