0

こんにちはすべて私はいくつかのコードをjoomlaファイルに入れました、そして私はファイルがアップロードされていないのに宛先パスとフォルダーパーミッションが正しいという問題に直面しています

これがコードです

$avatar_file = JRequest::getVar('image', null, 'files','array');
            $upfilename= str_replace($replace,'_',$avatar_file['name']);
            //echo JPATH_ROOT.DS.'images'.DS.'easyblog_avatar'.DS;
            //exit;
            print_r($_FILES);
            $arr = '{"google_profile_url":"","show_google_profile_url":""}';
            echo is_uploaded_file($_FILES['image']['tmp_name']).'<br>'.
            //$destFilePath = dirname(dirname(dirname(dirname(__FILE__)))).DS.'images'.DS.'easyblog_avatar'.DS.$user_id.'_'.$upfilename;
            $destFilePath = JPATH_ROOT.DS.'images'.DS.'easyblog_avatar'.DS.$user_id.'_'.$upfilename;
            //if(JFile::upload($avatar_file['tmp_name'], JPATH_ROOT.DS.'images'.DS.$user_id.'_'.$upfilename)){
            if(@move_uploaded_file($_FILES['image']['tmp_name'], $destFilePath)){
                $avatar = $user_id.'_'.$upfilename;
            }

ファイルのアップロードにはjoomla関数とコア関数の両方を使用していますが、アップロードされていません。

私を助けてください。

ありがとう

4

1 に答える 1

0
    //import joomlas filesystem functions, we will do all the filewriting with joomlas functions
    jimport('joomla.filesystem.file');
    jimport('joomla.filesystem.folder');

  //this is the name of the field in the html form, filedata is the default name for swfupload
$fieldName = 'Filedata';

    //the name of the file in PHP's temp directory that we are going to move to our folder
    $fileTemp = $_FILES[$fieldName]['tmp_name'];


    //always use constants when making file paths, to avoid the possibilty of remote file inclusion
    $uploadPath = JPATH_SITE.DS.'path'.DS.'path'.DS.$fileName;

    if(!JFile::upload($fileTemp, $uploadPath)) 
    {
            echo JText::_( 'ERROR MOVING FILE' );
            return;
    }
于 2012-10-16T18:25:17.253 に答える