Admin-only module for phpVMS v7 that lets staff upload files into pre-approved (whitelisted) folders on your server (ex: SPTheme banners, awards, tours, events, downloads). Each destination (“target”) can enforce its own file types, max size, and helper rules.
This build is based on the DVAssetUploader module skeleton (phpVMS-style providers) so phpVMS Updater can discover and run module migrations.
- Upload to approved folders (“targets”) you define
- Per-target rules:
- allowed file extensions
- max file size
- naming mode: original or unique
- optional overwrite (if enabled)
- optional UI hint (ex: required image dimensions)
- Logs uploads to DB table
asset_uploads(shows “Recent Uploads”) - Adds an Admin → Addons link
- Safe destination handling (prevents saving outside allowed roots)
- phpVMS v7
- PHP 8.1+
- Writable target folders (permissions)
- Recommended: access to phpVMS Updater (
/update) for migrations
Important: avoid nested folders. After install, you must have:
modules/AssetUploader/module.json(notmodules/AssetUploader/AssetUploader/module.json)
-
Upload/unzip the module to:
/modules/AssetUploader -
Enable the module:
- Admin → Addons → Modules → Enable AssetUploader
-
Run migrations via phpVMS Updater:
- Visit:
https://your-site.com/update
- Visit:
-
Clear cache (recommended):
- Admin → Maintenance → Clear Application Cache
- Or (CLI):
php artisan optimize:clear
-
Open the uploader:
https://your-site.com/admin/asset-uploader
This module registers migrations the phpVMS way:
Providers/AppServiceProvider.phpcalls:$this->loadMigrationsFrom(__DIR__ . '/../Database/migrations');
When you visit /update, phpVMS runs pending migrations (including module migrations) and will create:
asset_uploadstable
Some hosts block updater access or caching can interfere. Try:
- Clear bootstrap caches:
- delete
bootstrap/cache/*.php(or runphp artisan optimize:clear)
-
Revisit
/update -
If you have CLI access, you can run ONLY this module’s migration:
php artisan migrate --path=modules/AssetUploader/Database/migrations --forceEdit:
/modules/AssetUploader/Config/config.php
Default:
'middleware' => ['web', 'auth', 'role:admin'],✅ role:admin is recommended for phpVMS admin addon routes.
Laratrust
abilitymiddleware requires roles + permissions parameters. Avoidability:admin(it will throw “Too few arguments…”).
Targets are defined in the config under targets.
Example:
'targets' => [
'sptheme_banners' => [
'label' => 'SPTheme - Banner Images',
'base' => 'public',
'path' => 'SPTheme/images/banner',
'allowed_extensions' => ['jpg','jpeg','png','webp','gif'],
'max_size_kb' => 8192,
'naming' => 'unique',
'overwrite' => false,
],
'sptheme_awards' => [
'label' => 'SPTheme - Award Images',
'hint' => 'Awards MUST be 250px × 250px.',
'base' => 'public',
'path' => 'SPTheme/images/awards',
'allowed_extensions' => ['png','jpg','jpeg','webp'],
'max_size_kb' => 8192,
'naming' => 'unique',
'overwrite' => false,
],
'sptheme_tours' => [
'label' => 'SPTheme - Tour Graphics',
'hint' => 'Tour images MUST be 1024px × 1024px.',
'base' => 'public',
'path' => 'SPTheme/images/tours',
'allowed_extensions' => ['png','jpg','jpeg','webp'],
'max_size_kb' => 12288,
'naming' => 'unique',
'overwrite' => false,
],
];public→ uploads underpublic_path()(recommended for theme assets)storage→ uploads understorage_path()(non-public files)
This usually means the module is installed in a nested folder. Verify:
modules/AssetUploader/module.jsonexistsmodules/AssetUploader/Providers/AppServiceProvider.phpexists
If you see modules/AssetUploader/AssetUploader/..., move contents up one level.
Clear caches:
- delete
bootstrap/cache/*.php, then reload.
Your middleware is set to ability:admin. Change it to:
'middleware' => ['web','auth','role:admin']Run /update after enabling the module. If needed (CLI):
php artisan migrate --path=modules/AssetUploader/Database/migrations --force- Routes:
modules/AssetUploader/Http/Routes/admin.php - Controller:
modules/AssetUploader/Http/Controllers/Admin/AssetUploaderController.php - View:
modules/AssetUploader/Resources/views/admin/index.blade.php - Config:
modules/AssetUploader/Config/config.php - Migration:
modules/AssetUploader/Database/migrations/*create_asset_uploads_table.php
MIT