File Upload Path - Joomla! Forum - community, help and support


hello,
i'm building component requires administrator upload files @ backend (administration panel), , user can view file on frontend.

in order upload, i've used this:

code: select all

         $dest = jpath_component . ds . "uploads" . ds . $name;
         jfile::upload($src, $dest);

fresh joomla documentation. however, there 2 problems this:

1) jpath_component absolute path file @ server. upload goes smoothly, when wish display file, need relative path (to put in <img src=""> or whatever). how relative path?

2) jpath_component in administration panel points component administrator folder. think more correct put uploaded files in frontend component folder. there constant or somesuch gives me path frontend component folder?


thanks in advance.

why don't use images folder?

code: select all

$params =& jcomponenthelper::getparams('com_media');
// set path definitions
$path = "image_path";
define('com_media_base',    jpath_root.ds.$params->get($path, 'images/stories'));
define('com_media_baseurl', juri::root().$params->get($path, 'images/stories'));


from there on have com_media_base, , com_media_baseurl in component.

olaf





Comments

Popular posts from this blog

CS5 Adobe Media Encoder: Encode failed because the source duration is nil.

cf_sql_integer vs cf_sql_bigint vs cf_sql_int??

localhost/joomla15/administrator doesnt work - Joomla! Forum - community, help and support