PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
senzacionale
Forum Newbie
Posts: 9 Joined: Wed Dec 05, 2007 8:51 am
Post
by senzacionale » Sun Dec 09, 2007 7:27 am
I want to upload image to server by PHP but i get this error
Warning: move_uploaded_file(/home/turoglas/domains/turisticnioglasnik.si/public_html/dodano/223627514__.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/turoglas/domains/turisticnioglasnik.si/public_html/sistem/admin/slike.php on line 26
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpzzUB0V' to '/home/turoglas/domains/turisticnioglasnik.si/public_html/dodano/223627514__.jpg' in /home/turoglas/domains/turisticnioglasnik.si/public_html/sistem/admin/slike.php on line 26
Unknown image
This is my code:
Code: Select all
define('CMS_FIZICNA_POT', '/home/turoglas/domains/turisticnioglasnik.si/public_html');
$datoteka = basename($_FILES['file']['name']);
$datoteka = pocisti_datoteke($datoteka);
//$datoteka = rand() . '_' . $datoteka;
$slikovna_pot = CMS_FIZICNA_POT . '/dodano/';
$pot = $slikovna_pot . $datoteka;
if(file_exists($pot))
{
preusmeri_z_sporocilom('napaka', 'JEZIK_251', 'slike.php');
}
move_uploaded_file($_FILES['file']['tmp_name'], $pot);
/dodano is 777 permision but not working. Any idea why?
arjan.top
Forum Contributor
Posts: 305 Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia
Post
by arjan.top » Sun Dec 09, 2007 7:57 am
looks like that you dont have write permission in folder /home/turoglas/domains/turisticnioglasnik.si/public_html/dodano/
senzacionale
Forum Newbie
Posts: 9 Joined: Wed Dec 05, 2007 8:51 am
Post
by senzacionale » Sun Dec 09, 2007 8:17 am
i have 777 permissions but not wroking. I do not understand why not working. Maybe is problem safe_mod?
Last edited by
senzacionale on Sun Dec 09, 2007 8:33 am, edited 1 time in total.
arjan.top
Forum Contributor
Posts: 305 Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia
Post
by arjan.top » Sun Dec 09, 2007 8:23 am
chmodded via ftp?
CHeck if chmod is really 777 with:
Code: Select all
echo substr(sprintf('%o', fileperms('/tmp')), -4);
senzacionale
Forum Newbie
Posts: 9 Joined: Wed Dec 05, 2007 8:51 am
Post
by senzacionale » Sun Dec 09, 2007 8:57 am
yes via ftp. I checked with your code and it is 0777. Very strange. Mabye is problem safe_mod, but i do not know if my provider use it?
arjan.top
Forum Contributor
Posts: 305 Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia
Post
by arjan.top » Sun Dec 09, 2007 9:55 am
senzacionale
Forum Newbie
Posts: 9 Joined: Wed Dec 05, 2007 8:51 am
Post
by senzacionale » Sun Dec 09, 2007 12:01 pm
Thank you arjan.top. I get blank page so safe_mod does not exist.
Any idea why upload then not working?
Thanks
arjan.top
Forum Contributor
Posts: 305 Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia
Post
by arjan.top » Sun Dec 09, 2007 12:38 pm
senzacionale wrote: yes via ftp. I checked with your code and it is 0777. Very strange. Mabye is problem safe_mod, but i do not know if my provider use it?
have you changed /tmp to your folder in my code?
Code: Select all
echo substr(sprintf('%o', fileperms('/home/turoglas/domains/turisticnioglasnik.si/public_html/dodano/')), -4);
senzacionale
Forum Newbie
Posts: 9 Joined: Wed Dec 05, 2007 8:51 am
Post
by senzacionale » Sun Dec 09, 2007 12:46 pm
yes i changed it and i get code 0777. This is full permissions but i can not upload files.
senzacionale
Forum Newbie
Posts: 9 Joined: Wed Dec 05, 2007 8:51 am
Post
by senzacionale » Mon Dec 10, 2007 3:03 am
any idea maybe, i still did not solve my problem.
Thanks
alex.barylski
DevNet Evangelist
Posts: 6267 Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg
Post
by alex.barylski » Mon Dec 10, 2007 3:39 am
What are your results?
Have you contacted your hosting company and asked what they think?