What documention for File upload?

+
0
-

What docs are there that show the processing of file upload?

I have created the form using the docs at https://doc.nette.org/en/forms

And I can see the API at https://api.nette.org/…eUpload.html

But, how do I access the API to process the form?
Eg:

<?php
$form->addUpload('hero', 'Hero Image:')
     ->setRequired('Please select a Hero Image.')
     ->addRule(Form::IMAGE, 'Thumbnail must be JPEG, PNG or GIF')
     ->addRule(Form::MAX_FILE_SIZE, 'Maximum file size is 1Mb.', 1024 * 1024);
?>

So, in the formSucceed function, how is the hero image accessed?

Martk
Member | 661
+
0
-

Do you think this?

$form->onSuccess[] = function (Form $form, array $values): void {
	bdump($values['hero']);
};

Last edited by Martk (2020-02-08 20:48)

+
0
-

Close, but put me on the right path.
The bdump you suggest produces an error.

Error
Cannot use object of type stdClass as array

The information is found in $value->hero.

Thanks for the direction

>

Do you think this?

$form->onSuccess[] = function (Form $form, array $values): void {
	bdump($values['hero']);
};