getgrav / grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony
https://getgrav.org
MIT License
14.57k stars 1.41k forks source link

Error in processing registration form with custom fields #3438

Open JunekCZ opened 3 years ago

JunekCZ commented 3 years ago

I am trying to add file upload in the registration form of the Login plugin. I successfully added fields in the settings of the Login plugin and successfully showed them on my registration page /user_register created also by the Login plugin.

Now that error. When I hit the Register button, this error shows up: Whoops\Exception\ErrorException thrown with message "copy(theme://images/2na10fjswgn61.jpg): failed to open stream: "\RocketTheme\Toolbox\StreamWrapper\ReadOnlyStream::stream_open" call failed"

` Stacktrace:

42 Whoops\Exception\ErrorException in /var/www/subdomains/talent-management/system/src/Grav/Framework/Form/FormFlashFile.php:95

41 copy in /var/www/subdomains/talent-management/system/src/Grav/Framework/Form/FormFlashFile.php:95

40 Grav\Framework\Form\FormFlashFile:moveTo in /var/www/subdomains/talent-management/user/plugins/form/classes/Form.php:1025

39 Grav\Plugin\Form\Form:copyFiles in /var/www/subdomains/talent-management/user/plugins/form/classes/Form.php:949

38 Grav\Plugin\Form\Form:post in /var/www/subdomains/talent-management/user/plugins/form/form.php:278

37 Grav\Plugin\FormPlugin:onPageInitialized in /var/www/subdomains/talent-management/vendor/symfony/event-dispatcher/EventDispatcher.php:264

36 Symfony\Component\EventDispatcher\EventDispatcher:doDispatch in /var/www/subdomains/talent-management/vendor/symfony/event-dispatcher/EventDispatcher.php:239

35 Symfony\Component\EventDispatcher\EventDispatcher:callListeners in /var/www/subdomains/talent-management/vendor/symfony/event-dispatcher/EventDispatcher.php:73

34 Symfony\Component\EventDispatcher\EventDispatcher:dispatch in /var/www/subdomains/talent-management/system/src/Grav/Common/Grav.php:556

33 Grav\Common\Grav:fireEvent in /var/www/subdomains/talent-management/system/src/Grav/Common/Processors/PagesProcessor.php:45

32 Grav\Common\Processors\PagesProcessor:process in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:50

31 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:62

30 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Common/Processors/TwigProcessor.php:38

29 Grav\Common\Processors\TwigProcessor:process in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:50

28 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:62

27 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Common/Processors/AssetsProcessor.php:39

26 Grav\Common\Processors\AssetsProcessor:process in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:50

25 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:62

24 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Common/Processors/SchedulerProcessor.php:40

23 Grav\Common\Processors\SchedulerProcessor:process in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:50

22 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:62

21 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Common/Processors/BackupsProcessor.php:39

20 Grav\Common\Processors\BackupsProcessor:process in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:50

19 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:62

18 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Common/Processors/TasksProcessor.php:69

17 Grav\Common\Processors\TasksProcessor:process in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:50

16 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:62

15 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Common/Processors/RequestProcessor.php:63

14 Grav\Common\Processors\RequestProcessor:process in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:50

13 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:62

12 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Common/Processors/ThemesProcessor.php:38

11 Grav\Common\Processors\ThemesProcessor:process in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:50

10 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:62

9 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Common/Processors/PluginsProcessor.php:39

8 Grav\Common\Processors\PluginsProcessor:process in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:50

7 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:62

6 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Common/Processors/InitializeProcessor.php:130

5 Grav\Common\Processors\InitializeProcessor:Grav\Common\Processors{closure} in /var/www/subdomains/talent-management/system/src/Grav/Common/Debugger.php:546

4 Grav\Common\Debugger:profile in /var/www/subdomains/talent-management/system/src/Grav/Common/Processors/InitializeProcessor.php:131

3 Grav\Common\Processors\InitializeProcessor:process in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:50

2 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php:62

1 Grav\Framework\RequestHandler\RequestHandler:handle in /var/www/subdomains/talent-management/system/src/Grav/Common/Grav.php:295

0 Grav\Common\Grav:process in /var/www/subdomains/talent-management/index.php:58

`

As the destination, I chose to upload those images is plugin://images, which I created.

rhukster commented 3 years ago

The plugin:// stream is readonly.. You should store things in user://data stream.

mahagr commented 3 years ago

The stream is read-only because any content in plugins will be deleted on every plugin update.

JunekCZ commented 3 years ago

The plugin:// stream is readonly.. You should store things in user://data stream.

Okay, I have changed the directory to user://data/images but the problem still occurs.

copy(user://data/images/54fe805b8b97da022b4e74ba503a6b2d.png): failed to open stream: "\RocketTheme\Toolbox\StreamWrapper\ReadOnlyStream::stream_open" call failed

rhukster commented 3 years ago

did you create a folder called images ?

JunekCZ commented 3 years ago

Yes, I did. I also tried to run chmod 777 only if it is read-only too, but still no success.

mahagr commented 3 years ago

Use user-data://images, because of user is also read-only :)

JunekCZ commented 3 years ago

Use user-data://images, because of user is also read-only :)

This works! Thank you!

I hoped it would be as editable as in admin but I am happy with this.