File upload not working - Joomla! Forum - community, help and support


hi,

i trying create component has field upload file if needed, using jfile::upload upload file, getting true when call function, file not saved. have no clue might happening.


everything seems working right, can details of files, , temp file isnt moved folder.

code: select all

$file = jrequest::getvar('myicon', null, 'files', 'array');
        // retorna: array ( [name] => mod_simpleupload_1.2.1.zip [type] => application/zip
        // [tmp_name] => /tmp/phpo3vg9f [error] => 0 [size] => 4463 )
 print_r($file);
        if(isset($file)){
                //clean filename rid of strange characters spaces etc
                $filename = jfile::makesafe($file['name']);
 
                if($file['size'] > $max) $msg = jtext::_('only_files_under').' '.$max;
                //set source , destination of file
 
                $src = $file['tmp_name'];
                $dest = 'images' . ds ."collection_gallery".ds. $filename;
 
    echo $src." ". $dest;
                //first check if file has right extension, need jpg only
               
                   if ( jfile::upload($src, $dest) ) {
 
                       //redirect page of choice
                        $msg = jtext::_('file_save_as').' '.$dest;
                  echo('success');
                   } else {
                          //redirect , throw error message
                        $msg = jtext::_('error_in_upload');
                   }
               
 
                $msg = "<script>alert('". $msg ."');</script>";
        }

i appreciate pointers.


thanks.

fixed:

$dest = jpath_site.ds.'images' . ds ."collection_gallery".ds. $filename;


required





Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support