photogabble/laravel-remember-uploads
Laravel package that remembers file uploads between requests, helping uploaded files survive validation failures and form redisplay. It stores temporary uploads and simplifies repopulating file inputs without forcing users to upload again.
composer require the package.config/app.php entry required. On older versions, add the provider to providers and the facade/alias to aliases as documented.php artisan vendor:publish and review the new storage / temporary-path key (added in #16). Defaults work for a single app; override for multi-tenant or containerised setups.web group). The middleware is what intercepts incoming file inputs and persists them to temporary storage when validation fails.<input type="file" name="avatar"> and a validate() call. On a failed submission the file survives the redirect; in your Blade view call rememberedFile('avatar') to retrieve it and repopulate the field.Start by reading the (substantially improved in #17) README — particularly the middleware registration and config sections — then trace a single upload through validation failure to rememberedFile().
rememberedFile('field') and decide whether to re-display, re-process, or promote to permanent storage. Do not manually move() on the failed request — the middleware already captured it.name="documents[]" with multiple), so the same rememberedFile('documents') call returns the collection. This makes multi-upload forms finally behave like single-field ones.rememberedFile() is non-null, otherwise render a plain file input. This keeps the "remember me" affordance invisible on first load.$request->file() (validation middleware, form-request authorisation is fine, but your own upload-handling middleware should run after it).config/app.php; feature-detect rather than branching per environment.oldFile() is deprecated. Swap every call to rememberedFile(). It still works in 1.3.0, but expect removal in a future major — grep your views and keep the rename in one commit so the diff is reviewable.null returns. When rememberedFile() returns null, the usual cause is that the middleware never ran (wrong route group, ordering, or excluded path). Check middleware registration before suspecting the storage path.$request->file() and the resolved temp path inside the middleware to confirm interception; then confirm the same path resolves in the controller. If both match, the problem is your view call, not the package.rememberedFile rename and the array-input fix.How can I help you explore Laravel packages today?