Hi, GIJOE.
It has nothing to do with your modules, so I don't know whether it's okay to ask it here or not, but anyways I'm already doing it... ^^'
I'm making a hack of contact module and I'm trying to add attached files feature.
The question is about XoopsMediaUploader class. I'd like to know if to use fetchMedia I have to also use upload. (I want it to check the file without storing it on cache)
My code is a little messy, but here's a piece of it:
if ($xoopsModuleConfig['mailform_attach'] == 1) {
$_POST['xoops_upload_file'][0] = $_SESSION['xoops_upload_file'][0];
include_once(XOOPS_ROOT_PATH."/modules/mail/class/uploader.php");
$uploader = new MailMediaUploader($xoopsModuleConfig['mailform_attachdir'], $xoopsModuleConfig['mailform_attachmime'],$xoopsModuleConfig['mailform_attachmaxsize']);
if($uploader->fetchMedia($_POST['xoops_upload_file'][0])){//if($uploader->fetchMedia($_POST['xoops_upload_file'][0]) && $uploader->upload()){
//unlink($uploader->getSavedDestination());
}else{
$errflg=true;
$errmsg = $uploader->getErrors();
//unlink($uploader->getSavedDestination());
}
//$_SESSION['filename'] = $_FILES['attach']['name'];
}
This code will show after the user submits the form and is directed to a confirmation screen.
I thought about using upload() and after that using unlink to delete it, but it's kind of inefective, since it'd have to upload it again in the next screen if the file is approved.
Any ideas?
Thanks in advance m(_ _)m
-Yuji