Roundcube Community Forum
News and Announcements => General Discussion => Topic started by: laurisnet on April 01, 2009, 02:20:31 PM
-
Hello,
I have made custom upload form for file upload and when file is uploaded it execute some other file not attachment.inc.
So my question is following:
How i can get in my upload script (upload.php) to return roundcube varialbes and sessions such as:
$RCMAIL->user->get_username();
$_SESSION['compose'];
Thanks.
-
Either you disable database managed session (see sessions.inc) of you access your custom upload form by including it in index.php.
-
Ok, i fixed my problem, there is another problem :)
With whitch commands i can add and remove attachemnt from mail content?
If i am not mistaking then i have to check this:
$id = count($_SESSION['compose']['attachments']);
$_SESSION['compose']['attachments'][] = array(
'name' => $_FILES['_attachments']['name'][$i],
'mimetype' => rc_mime_content_type($tmpfname, $_FILES['_attachments']['type'][$i]),
'path' => $tmpfname,
);
if (is_file($icon = $CONFIG['skin_path'] . '/images/icons/remove-attachment.png')) {
$button = html::img(array(
'src' => $icon,
'alt' => rcube_label('delete'),
'style' => "padding-right:2px;vertical-align:middle",
));
}
else {
$button = Q(rcube_label('delete'));
}
$content = html::a(array(
'href' => "#delete",
'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%d', this)", JS_OBJECT_NAME, $id),
'title' => rcube_label('delete'),
), $button);
$content .= Q($_FILES['_attachments']['name'][$i]);
in attachment.inc
-
I am not including my upload.php file in index.php, but i can get response from this file, what js response i need for rcube?
thanks
-
I guess i have to add all necesarry to this $_SESSION['compose']['attachments'][];
Right?
-
I do not have the whole Roundcube code in mind. But I remember that I have used this session array when coding my forward as attachment plugin.
-
CAn you tell me, is this session array created at the moment i made upload or its created before i upload file?
-
The upload creates a $_FILES array. Uploads do not touch the $_SESSION array() automatically.
-
ok with print_r($_SESSION); i get empty array.
What exacly i need to post back after upload completes?
And what is in this:
$_SESSION['compose']['attachments'];
and
rc_mime_content_type();
its used in attachment.inc file!
Mime tipe is not that much important at the moment, but what is in this $_SESSION['compose']['attachments'] thats interesting :)
thanks
-
As already mentioned RoundCube $_SESSION is only available if script is included in index.php by using appropriate task and action. An alternative is to disable RoundCube's database managed sessions by hacking sessions.inc.
OK, I'm off this thread.
-
ok thanks anyway ;)