Add chunked uploads and raise storage rate to GHS 0.30/GB/month.
Deploy Ladill Transfer / deploy (push) Successful in 39s

Large files upload in 5 MB chunks (hosting file manager pattern) for the
transfer UI and Ladill Mail S2S API, with no app-level file size cap when
TRANSFER_MAX_FILE_BYTES=0.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-08 12:07:27 +00:00
co-authored by Cursor
parent fb131cd7fa
commit 65b634bb0b
23 changed files with 797 additions and 27 deletions
@@ -7,6 +7,7 @@ use App\Models\Transfer;
use App\Services\Qr\QrImageGeneratorService;
use App\Services\Qr\QrPdfExporter;
use App\Services\Transfer\TransferService;
use App\Services\Upload\ChunkedUploadService;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
@@ -19,6 +20,7 @@ class TransferController extends Controller
{
public function __construct(
private TransferService $transfers,
private ChunkedUploadService $chunkedUploads,
private QrImageGeneratorService $imageGenerator,
private QrPdfExporter $pdfExporter,
) {}
@@ -42,7 +44,7 @@ class TransferController extends Controller
return view('transfer.transfers.create', [
'defaultRetentionDays' => (int) config('transfer.default_retention_days', 30),
'maxFiles' => (int) config('transfer.max_files_per_transfer', 20),
'pricePerGb' => (float) config('transfer.price_per_gb_month', 0.15),
'pricePerGb' => (float) config('transfer.price_per_gb_month', 0.30),
]);
}
@@ -50,19 +52,47 @@ class TransferController extends Controller
{
$account = ladill_account();
$maxBytes = (int) config('transfer.max_file_bytes', 0);
$fileRules = ['nullable', 'file'];
if ($maxBytes > 0) {
$fileRules[] = 'max:'.(int) ceil($maxBytes / 1024);
}
$data = $request->validate([
'title' => 'required|string|max:120',
'message' => 'nullable|string|max:2000',
'password' => 'nullable|string|min:4|max:64',
'retention_days' => 'nullable|integer|min:1|max:365',
'files' => 'required|array|min:1',
'files.*' => 'required|file|max:'.((int) config('transfer.max_file_bytes', 524288000) / 1024),
'files' => 'nullable|array',
'files.*' => $fileRules,
'upload_ids' => 'nullable|array',
'upload_ids.*' => 'required|string|uuid',
]);
$ownerKey = 'user:'.$account->id;
$files = array_values($request->file('files', []) ?? []);
$uploadIds = array_values($data['upload_ids'] ?? []);
if ($files === [] && $uploadIds === []) {
return back()->withInput()->with('error', 'Add at least one file to share.');
}
foreach ($uploadIds as $uploadId) {
try {
$files[] = $this->chunkedUploads->toUploadedFile($uploadId, $ownerKey);
} catch (RuntimeException $e) {
return back()->withInput()->with('error', $e->getMessage());
}
}
try {
$transfer = $this->transfers->create($account, $data, $request->file('files', []));
$transfer = $this->transfers->create($account, $data, $files);
} catch (RuntimeException $e) {
return back()->withInput()->with('error', $e->getMessage());
} finally {
foreach ($uploadIds as $uploadId) {
$this->chunkedUploads->cleanup($uploadId);
}
}
return redirect()