Current location: Hot Scripts Forums » Programming Languages » PHP » upload permission issue


upload permission issue

Reply
  #1 (permalink)  
Old 09-01-10, 08:14 AM
glaucomerlim glaucomerlim is offline
New Member
 
Join Date: Sep 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
upload permission issue

Hello Friends!

I have a site on my service to migrate to another server. It has an administration panel where do I upload files. Flv,. Mp3 and. Jpg where can be seen in the body of the site with jwplayer.

When I try to upload these files on the server it appears the following error:

Warning: move_uploaded_file (/ usr / local / apache / htdocs \ videos \ 8.flv) [function.move-uploaded-file]: failed to open stream: Permission denied in / home/recmu540/public_html/carregar_arquivo_upload.php on line 24


Warning: move_uploaded_file () [function.move-uploaded-file]: Unable to move '/ tmp/phpPrLyU8' to '/ usr / local / apache / htdocs \ videos \ 8.flv in / home/recmu540/public_html/carregar_arquivo_upload. php on line 24


I contacted the hosting server and they say I need to change the address "/ usr / local / apache / htdocs" and put the correct path to folder with permission.

The point is that the files do not have that path. Below I put the code of this file that is giving error

PHP Code:

<?php
if (!empty($_FILES)){// && file_exists($arquivo)

    
if($tipo == 'tv'){
        
$uploaddir '.\\videos\\';
    }else{
        if(
$tipo == 'radio'){
            
$uploaddir '.\\radios\\';
        }else{
            
$uploaddir '.\\locucoes\\';
        }
    }
    
    if(
$_FILES['arquivo_jpg']['tmp_name']){
/*        $c_url_arquivo_jpg = $uploaddir.$_FILES['arquivo_jpg']['name'];
        $c_url_arquivo_jpg = str_replace('.\\','\\',$c_url_arquivo_jpg);
        $c_url_arquivo_jpg = str_replace('\\','/',$c_url_arquivo_jpg);
*/
        
$c_url_arquivo_jpg $_SERVER['DOCUMENT_ROOT'].substr($uploaddir.$_FILES['arquivo_jpg']['name'],1);
        if (
move_uploaded_file($_FILES['arquivo_jpg']['tmp_name'], $c_url_arquivo_jpg)) {
            
$erro_upload "0"//naum ocorreu erro, zera variavel auxiliar
        
}else{
            
$erro_upload "1"// ocorreu erro, aponta 1 na variavel auxiliar            
        
}
        
//        die($erro_upload.'_teste_'.$c_url_arquivo_jpg);
        
$c_url_arquivo_jpg str_replace($_SERVER['DOCUMENT_ROOT'],'.',$c_url_arquivo_jpg);
        
$c_url_arquivo_jpg str_replace('\\','/',$c_url_arquivo_jpg);
    }
        
}else{
  echo(
"<script>alert('Selecione um arquivo v&aacute;lido');</script>");
}
?>
If anyone can help me be very grateful, because I am not an expert in PHP
Thanks
Glauco

Last edited by UnrealEd; 09-01-10 at 11:27 AM. Reason: fixed [php] tags
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-01-10, 11:30 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
On Linux servers you have to have permissions to read, execute and write to files and folders. The error you're getting is stating that you do not have the permission to write into the "/ usr / local / apache / htdocs / videos" folder. Have a look at file permissions on php.net for more information
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Upload Issue tommyc325 PHP 12 06-20-07 11:39 PM
Firefox Image Upload Issue klassix PHP 2 02-25-07 11:46 AM
i have a file upload issue.... stormshadow PHP 5 12-03-05 10:57 PM
ASP upload prob minority ASP 1 06-27-05 09:35 AM
PHP Script Request DazzlyWorks Script Requests 0 01-16-05 02:23 PM


All times are GMT -5. The time now is 06:21 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.