...

View Full Version : Permissions Problem



bnorris
01-24-2012, 09:44 PM
Hi peeps,

I need help. This is part of a code that uploads images to my webserver however it wont assign permissions. I need the files that upload (pics) to have 775,, can anybody help?

[php]copy ($line[tmp_name], '../temp/' . $file);
$new = new_dim ($info[0], $info[1], $sizes[small][0], $sizes[small][1]);
resize ('../temp/' . $file, 'cp-thumbs/' . $file, $info[0], $info[1], $new[x], $new[y], $info[2]);
$new = new_dim ($info[0], $info[1], $sizes[thumb][0], $sizes[thumb][1]);
resize ('../temp/' . $file, '../thumbs/' . $file, $info[0], $info[1], $new[x], $new[y], $info[2]);
$new = new_dim ($info[0], $info[1], $sizes[large][0], $sizes[large][1]);
resize ('../temp/' . $file, '../images/' . $file, $info[0], $info[1], $new[x], $new[y], $info[2]);
$new = new_dim ($info[0], $info[1], $sizes[enlarge][0], $sizes[enlarge][1]);
resize ('../temp/' . $file, '../enlarge/' . $file, $info[0], $info[1], $new[x], $new[y], $info[2]);
unlink ('../temp/' . $file);
mysql_query ('INSERT INTO ' . $dbimgs . ' VALUES(\'0\', \'' . $_POST['id'] . '\', \'' . $file . '\')', $link);
mysql_query ('UPDATE ' . $dblist . ' SET images=images+1 WHERE id=\'' . $_POST['id'] . '\' LIMIT 1', $link);
$upload = true;
continue;[php]

DarkLaika
01-24-2012, 09:54 PM
If you make the images upload into a folder with permissions 775 then they should all have 775 as their default permission.

BluePanther
01-24-2012, 09:58 PM
You'll want to use chmod - http://www.php.net/manual/en/function.chmod.php

bnorris
01-24-2012, 09:58 PM
If you make the images upload into a folder with permissions 775 then they should all have 775 as their default permission.

You would think but it dosent, It sets them to 600 :( Is it an Apache thing?

bnorris
01-24-2012, 10:03 PM
You'll want to use chmod - http://www.php.net/manual/en/function.chmod.php

Hello Sir,

Not real good with PHP but should I insert a tag like this somewhere?

[php] chmod("/mydir", 755);[p]

tangoforce
01-24-2012, 10:03 PM
You would think but it dosent, It sets them to 600 :( Is it an Apache thing?

No its down to the filesystem settings of the host OS.

BluePanther
01-24-2012, 10:07 PM
Hello Sir,

Not real good with PHP but should I insert a tag like this somewhere?

[php] chmod("/mydir", 755);[p]

Yeah like that, but for all the files in the dir. You could do that using one of the recursive iterator SPL objects, or just track the files your uploading and chmod them through there (definitely the best option).

bnorris
01-24-2012, 10:10 PM
Yeah like that, but for all the files in the dir. You could do that using one of the recursive iterator SPL objects, or just track the files your uploading and chmod them through there (definitely the best option).

This script is a photo uploader and it dose many a day. Funny thing is it works on other (unix) servers ok but not this Linux box :( Would it hel if I posted the whole page? pastebin??

BluePanther
01-24-2012, 10:12 PM
No its down to the filesystem settings of the host OS.

This.

bnorris
01-24-2012, 10:15 PM
This.


Would you happen to know what setting in Apachie?

tangoforce
01-24-2012, 10:18 PM
Would you happen to know what setting in Apachie?

Again, it's down to the filesystem of the host OS

Not Apache, not the FTP server, the OPERATING SYSTEM.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum