I was going to ask about the =200, but I see: if it's above 50, it will happen after stdconfig.php is loaded, so everything you need will be there.
I had missed the way that was called; thanks, Petko. On Sat, Apr 29, 2017 at 12:25 PM, Petko Yotov <[email protected]> wrote: >> From inside of config.php I need a good way to get >> the physical upload directory path (full path), >> or good way to create an attachment automatically. > > > Here is a function in config.php that will be launched after all required > scripts have been loaded: > > $PostConfig['CheckOrCreateUpload'] = 200; > function CheckOrCreateUpload($pagename) { > global $UploadFileFmt; > > $upname = "MyFile.txt"; # name of the uploaded file > > $pn = "Main.WiniSandbox"; # attached to specific page - OR - > # $pn = $pagename; # attached to current group/page > > $upname = MakeUploadName($pagename, $upname); # standard characters > $filepath = FmtPageName("$UploadFileFmt/$upname", $pagename); > > if (!file_exists($filepath)) { > file_put_contents($filepath, "Created ".strftime("%c")); > } > } > > The function will look for an uploaded file with a specific name, attached > to a specific page (or group, respecting your configuration). If such a file > does not exist, it will be created. > > The function is added to $PostConfig in order to let all configuration, > farm, local, group, page, to be loaded, then the upload.php script to be > loaded in the correct order (after prefs and forms) to include all > functions, and before any PmWiki action (edit, browse, diff, download...) is > processed. > > Petko > > _______________________________________________ > pmwiki-users mailing list > [email protected] > http://www.pmichaud.com/mailman/listinfo/pmwiki-users _______________________________________________ pmwiki-users mailing list [email protected] http://www.pmichaud.com/mailman/listinfo/pmwiki-users
