Get File Name - Upload Field

tiagovareta

Member
Hi,

I have a form that is not associated with a database. I use this form to send files.
In this case, I do not want to save the file path.

In the form processing, in the area of plugins, I have a pulgin php, to send the email with the files that we are uploading.

I put the code, to get the name of the file, but it is left blank:
$comp = $formModel->getElementData('___comp_mr_adp3');

How can I put the file name, which was uploaded into a variable?
 
You'll probably need to access the files input directly ... I have a feeling the path isn't inserted into the form data till "afterProcess", which probably won't get run if you aren't storing data.

So the file data would be in ...

$app = JFactory::getApplication();
// file paths should be in $app->input->files, but I can't remember the structure, so dump it to test ...
var_dump($app->input->files);exit;

Alternatively, look directly in PHP's $_FILES array.

-- hugh
 
You'll probably need to access the files input directly ... I have a feeling the path isn't inserted into the form data till "afterProcess", which probably won't get run if you aren't storing data.

So the file data would be in ...

$app = JFactory::getApplication();
// file paths should be in $app->input->files, but I can't remember the structure, so dump it to test ...
var_dump($app->input->files);exit;

Alternatively, look directly in PHP's $_FILES array.

-- hugh

Hi Cheesegrits,

Many thanks for the reply!
With your tip I managed to revolve the situation. I put in the form event: afterProcess, and it worked!

Thank you very much!
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top