芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/store.kwesioben.com/app/Http/Controllers/Admin/FileManagerController.php
validate([ 'images' => 'required_without:file', 'file' => 'required_without:images', 'path' => 'required', ]); if ($request->hasfile('images')) { $images = $request->file('images'); foreach ($images as $image) { $name = $image->getClientOriginalName(); Storage::disk('local')->put($request->path . '/' . $name, file_get_contents($image)); } } if ($request->hasfile('file')) { $file = $request->file('file'); $name = $file->getClientOriginalName(); Madzipper::make($file)->extractTo('storage/app/' . $request->path); } Toastr::success(\App\CPU\translate('image_uploaded_successfully')); return back()->with('success', \App\CPU\translate('image_uploaded_successfully')); } public function download($file_name) { return Storage::download(base64_decode($file_name)); } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // } public function destroy($file_path) { Storage::disk('local')->delete(base64_decode($file_path)); Toastr::success(trans('messages.image_deleted_successfully')); return back()->with('success', trans('messages.image_deleted_successfully')); } }