Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help me "Warning: move_uploaded_file"

    I am getting this error in my code:

    Warning: move_uploaded_file(../images/Image/product/480e5a9f_812.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/apple8/domains/apple8.vn/public_html/includes/function_admin.php on line 440

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phprtGs9z' to '../images/Image/product/480e5a9f_812.jpg' in /home/apple8/domains/apple8.vn/public_html/includes/function_admin.php on line 440



    code:

    PHP Code:
    [QUOTE]function uploadFile($File$FileCu$path$preFix, &$FileCapNhat$LimitFileSize, &$err_flag, &$err_msg)
    {
        
        if ( 
    $File['size'] < $LimitFileSize)
        {
            
    $FileCapNhat $FileCu;
            
            if (
    $File['name'] != '')
            {
                if (
    is_uploaded_file($File['tmp_name']) )
                {
                    
    $FileCapNhat $File['name'];
                    
                    if (
    file_exists($path.$FileCapNhat))
                    {    
                        
    $path_parts pathinfo($FileCapNhat);
                        
    $baseName    $path_parts["basename"];
                        
    $extension    $path_parts["extension"];
                        
    $baseName   substr($baseName0strlen($baseName) - strlen($extension) - 1);
                        while (
    is_file($path $baseName "_$preFix" '.' $extension)) $preFix++;
                        
    $FileCapNhat $baseName "_$preFix" '.' $extension;
                    }
                    
                    
                
                    if (
    move_uploaded_file($File['tmp_name'], $path $FileCapNhat))
                    {
                        if (!empty(
    $FileCu))
                        {
                            if (
    is_file($path $FileCu)) 
                            {
                                
    unlink ($path $FileCu);
                                
                            }
                        }

                    }
                }
                else
                {
                    
    $err_flag++;
                    
    $err_msg 'File: "' $File['name'] . '" must has size < ' $LimitFileSize " bytes (=2MB)";
                }
            }
            
        }
        else
        {
            
    $err_flag++;
            
    $err_msg 'File: "' $File['name'] . '" must has size < ' $LimitFileSize " bytes (=2MB)";
        }
    }[/
    QUOTE

  • #2
    Regular Coder seco's Avatar
    Join Date
    Nov 2008
    Location
    Oregon
    Posts
    687
    Thanks
    6
    Thanked 79 Times in 77 Posts
    check the permissions for these folders

    images/
    Image/
    product/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •