migxResourceMediaPath throws an error - Failed to initialize the media source "ResourceMediaPath"!

Hello dear MODX community, I have a problem with multifile-uploader with MIGX, I do everything according to the article from the documentation - Using resource-specific mediasource and multifile-uploader with MIGX. The error lies in the fact that a notification of this type comes to MODX error.log:

(ERROR @ C:\OSPanel\domains\site\core\src\Revolution\Sources\modFileMediaSource.php : 57) Could not initialize "ResourceMediaPath" Media Source! Unable to create a directory at . mkdir(): Invalid path

But strangely enough, a folder is created and images are successfully loaded into it.
Can you tell me how to remove this entry from error.log, it is very annoying!

Some additional information:

  1. I have already reinstalled MODX to a newer and cleaner version, it did not give results, the error remains
  2. The rights to the folder were granted to 755, and also issued the rights to 777, but the error still remains
  3. I used a Bug fix from Bruno - migxResourceMediaPath create empty folders, but unfortunately the error still comes in error.log
  4. The error occurs after I create a new document with a template to which Template Variables with MIGX is attached, two error messages appear after creation and then several entries in error.log are re-created at random time
  5. I specify the basePath and urlPath paths as follows -
    [[migxResourceMediaPath? &pathTpl=assets/resourceimages/{id}/ &checkTVs=resourcealbum &createFolder=1 ]]
    Before applying the Bugfix from Bruno, I indicated the paths like this -
    [[migxResourceMediaPath? &pathTpl=assets/resourceimages/{id}/ &createFolder=1 ]]

A few screenshots of the problem:

Sorry to bother @Bruno17, but maybe you know how to solve this problem?

maybe that commit helps:
[migxresourcemediapath] change loglevel to MODX_LOG_LEVEL_DEBUG · Bruno17/MIGX@c0a1674 (github.com)

or installing 3.0.0 beta1

MIGX/migx-3.0.0-beta1.transport.zip at master · Bruno17/MIGX (github.com)

1 Like

I am glad to see you in my topic, once again I apologize for the trouble. The bugfix that you suggested also did not help, now I will try to install the beta version of MIGX, if there are improvements I will let you know.

UPD
Unfortunately, installing 3.0.0 beta did not give the desired result.

but at least the message docid could not be determined is gone, right?
I will have a look at the other one

1 Like

Yes docid was gone, I didn’t notice right away because the underlying problem was with invalid path()

this is, because MODX tries to load that mediasource, not only when you are editing a resource.
In this cases, the snippet in that mediasource can’t return a valid path.
The only way arround this, is creating a default or fallback directory for that mediasource.

With this commit
[migxresourcemediapath] create fallback directory · Bruno17/MIGX@017b496 (github.com)

a fallback folder will be created by that snippet, if it doesn’t exist.

Unfortunately, the problem remains, sadly(((

do you have replaced the snippet code with the new one?
Not the file, but the snippet?
This should create a new folder assets/migxfallback/ if nothing else is specified with &fallbackPath

Yes, I replaced the fragments, tried to create a resource that uses TV and this error crashes again. fallbackPath did not change.