Welcome Guest, Not a member yet? Register   Sign In
Changing file owner after uploading the file
#1

[eluser]cpp643[/eluser]
Hello,

I have problem in file uploading, some time it won't work and if it will then it have different file owner name. any suggestion... :blank:
#2

[eluser]fensen[/eluser]
1. Have you tried changing php.ini settings?
Quote:upload_max_filesize = 2M

max_execution_time = 30seconds

memory_limit = 128M

2. Is the temp dir writable?

3. Have you checked the Apache error log? It helps a lot.
Quote:sudo tail -100 /var/log/httpd/error_log

4. If nothing works, please post your code.
#3

[eluser]Christopher Blankenship[/eluser]
Normally you don't have to do this but if you have a really stubborn server you can also if in a unix or linux environment use the chown and chmod commands on the file after it has been uploaded. I have only found this necessary once for a particular host server. It was very problematic and is a tall tale sign of a server administrator that has not setup things correctly.
#4

[eluser]cpp643[/eluser]
yes you are rite but if file is from different owner then how can i use chmod cmd ?.

and file owner information is changed after uploading the file.. that is the problem.
#5

[eluser]Christopher Blankenship[/eluser]
1. who is the owner of the file when the file is uploaded using the upload code?
2. who is the owner of the files that were ftp'd to the server your files such as index.php and so forth?
3. post your code so we can see if this may be a host issue or programming issue.
#6

[eluser]cpp643[/eluser]
$config['allowed_types'] = 'zip';
$config['max_size'] = '10240';

$config['upload_path'] = $_SERVER['DOCUMENT_ROOT']."/abc/temp/" . $flderName ."/";

$data = array('upload_data' => $this->upload->data($folderIndex));

$newFileName = $_SERVER['DOCUMENT_ROOT']."/abc/temp/" . $flderName ."/" . strtolower($flderName)."_".date('H').date("i").date("s").".zip";

$dataArr = $data['upload_data'];
$upFileName = $dataArr['file_name'];
$tempFileName = $flderName.'.zip';

rename($newFileName,$tempFileName);


i am renaming the server file for backup and replace new uploaded file on it that time file owner is changed,today i have got new problem in uploading, same code is working on firefox on win xp but not working on ubantu's firefox with same version. but still not getting why uploaded file owner is going to be changed..??
#7

[eluser]Adam Griffiths[/eluser]
If you have shell access / SSH, and are on unix, the command to change ownership of a file is like this:-

Code:
chown <user> path/to/file
#8

[eluser]Christopher Blankenship[/eluser]
Thank you Adam Griffiths for the information on chown. here's some more:

chown -R <user>:<group> file
This information is here.

I don't see anything that screams out to me off hand other than function rename() [post this code] since if I am reading your message correctly is where the owner is being changed. then i will do some test this evening. Will address the first issue the second may be resolved from the first but I will test that as well as I use Ubuntu on my development system.




Theme © iAndrew 2016 - Forum software by © MyBB