#### Category : file

I’m able to delete the image from the local driver using the below logic when I use php unlink method but when I use Storage facade the post get’s deleted but the image is not deleted. I’ve tried playing around with the Facade way but I can’t seem to have it work. What I’m I ..

I am trying to store the file (resume) I receive from my input form into my assets folder, so I can download later. $applicant = new Applicant;$applicant->resume = $request->input(‘resume’);$filename = time().’.’. $applicant->resume->getClientOriginalExtension();$request->resume->move(‘assets’, $filename); Sourc.. Read more I’m working with Laravel 5.8 and I want to upload two videos, so I coded this at the Controller: if ($request->file(‘prd_video’) AND $request->file(‘prd_video_preview’)) {$video = Request::file(‘prd_video’); $videoname =$video->getClientOriginalName(); $path = public_path().’/upload/video/products/’;$moved = $video->move($path, $videoname);$video_preview = Request::file(‘prd_video_preview’); $videoname_preview =$video_preview->getClientOriginalName(); $path_preview = public_path().’/upload/video/products/preview/’;$moved_preview = $video->move($path, $videoname_preview); } But now I get .. Read more I can’t see this method in facade and in related to this facade class. Can anyone tell me how this "magic" actually works or at least provide some links with explanation? Sourc.. Read more When uploading images I realize FIRST I can use store method which saves images in the storage/app/public by default then I’ll have to create a symbolic link from public/storage to storage/app/public to access the image. SECOND, I can still use move method and have the image saved in the public/images directly. I feel like the .. Read more I’m working on the file upload task. When I’m trying to upload a file on-page, it is throwing me the following error. I checked the syntax looks good. Can anyone help me in fixing this issue? Code if(array_key_exists(‘fileToUpload’,$request->all())) { $access_time = Carbon::now()->format(‘mdYHis’);$directory = storage_path() . "app/public/huntSchedule"; $files =$request->fileToUpload; $filename =$access_time.’_photo’.Auth::user()->id.’.’.$files->getClientOriginalExtension(); File::copy($files,$directory.’/’.$filename); ..

I am using File::copy to copy the uploaded file from the main folder into my target folder. But it keeps saying there is no such file or directory. public function store(Request $request) {$data = $request->validate([ ‘name’ => ‘required’, ‘product_id’ => ‘required’, ‘price’ => ‘required’, ‘file’ => ‘required’, ‘file.*’ => ‘mimes:jpeg,jpg,png,svg,gif,csv,xlsx,pdf,docx’, ‘publish’ => ‘required’, ]); .. Read more I was able to store and save multiple files in the array into the database. But the problem is when updating the data, the array element(files) stored in the database is in a different format, which it is actually stores nothing but it can get the file name only. Before updating (Uploaded data which can .. Read more I want to upload documents/attachments for each product and store them in the public folder, where the documents can be pdf, images and csv. I was able to upload multiple files in the public folder but didn’t save the files’ data into the database. Model protected$fillable = [ ‘product_id’, ‘name’, ‘price’, ‘file’, ‘publish’, ]; ..

I’m currently on a laravel 5.8 + vue.js 2 project and I want to be able to upload an array of files in a form so it can appear inside the form data and saved. Inside my form there is a Vue component, made to display the intended files to upload. <input name="documents[0][files]" accept="image/*,application/pdf" type="hidden" ..

In the following route, inspecting the image paths that this method returns, they all have "/categories/" at the start but this is not right, the actual path should be /public/images/categories/gallery/1 not /public/categories/images/categories/gallery/1 Route::get(‘/categories/{group:id}’, function (Group $group) {$images = Storage::disk(‘public_path’)->files(‘images/categories/gallery/’ . $group->id); return view(‘categories.index’, [‘group’ =>$group], compact(‘images’)); })->name(‘categories’); The following is an example of ..

I am new to Laravel. so I have 3 hosts : one which my website is on, the next 2 ones are my download servers. I want to make VIP access on my site for downloading files that are on my download servers. my problem here is some of my links are directed to my ..

I wrote these code for upload files through laravel 6. But I only success for upload one file,even I am sure I got all files while uploading by check from dd($request->files) in the begining the$index = 0 and in the end it change to 1,first round is ok but the it didn’t continue to ..

I am working on the Laravel 8.0 (php 8). Need to zip about 5 folders that contains 10 images files and 1 pdf file stored in S3 storage, and download it. I have a code that works well on local storage. $zip = new ZipArchive(); if ($zip->open(Storage::disk(self::STORAGE_DISK)->path($pathToArchive), ZipArchive::CREATE | ZipArchive::OVERWRITE) === TRUE) {$userDir = ..

posting this again because I didn’t find to solution yet. Laravel can’t found the file storage/app/public/upload when I usehttp://127.0.0.1:8000/storage/upload/The_fileName.x I get 404 not found I’ve tried http://127.0.0.1:8000/storage/app/public/upload/The_fileName.x too. what should I do ? In DocumentController : public function store(Request $request) {$request->validate([ ‘doc’ => "required",… ]); $document = new document();$file = $request->file(‘doc’);$filename=time().’.’.$file->getClientOriginalExtension() ; .. Read more I’m a just a beginner and I need your help. I used php artisan storage:link I get error 404 Not Found when I use <iframe src="/storage/uploaded/{{$data->doc}}">. Even if I write <iframe src="/storage/uploaded/1628544440.docx"> I still get 404 Not Found. 1628544440.docx is the file name in DB and uploaded folder. The documents in the folder /storage/app/public/uploaded have ..

I’m a just a beginner and I need your help. I get error 404 Not Found when I use <iframe src="/storage/uploaded/{{$data->doc}}">. Even if I write <iframe src="/storage/uploaded/1628544440.docx"> I still get 404 Not Found. 1628544440.docx is the file name in DB and uploaded folder. The documents in the folder /storage/app/public/uploaded have the same name of documents->doc .. Read more I have a FILES variable that looks like this: I am trying to receive these files at my Laravel controller like so: if(!empty($request->allFiles())) … var_dump($request->all()); # debug I am posting to this endpoint using the fetch API like so: let fd = new FormData(); fd.append(‘files[]’, FILES) fetch(‘{{ url()->to(route(‘gallery.upload’)) }}’, { method: ‘POST’, credentials: "same-origin", headers: .. Read more I see a lot of answers to this question, but they are all very naive, and I wouldn’t consider them a solution, just a workaround (e.g. this one) What I have are 2 Laravel projects, one for administration and one for the "ecommerce" Now, let’s say the administrator uploads some images, and I want to .. Read more How to save my response to storage?$headers = array( "Content-type" => "text/html", "Content-Disposition" => "attachment;Filename=Contract.docx" ); $content = View::make(‘contracts.test’);$file = Response::make($content,200,$headers); Storage::disk(‘google’)->put($path,$file); Next is working for received file from form but not for code above Storage::disk(‘google’)->put($path,$request->file); Thanks Sourc..

need to save file image using ajax in laravel i use this code controller public function store(Request $request) {$item = new Item; // if remove $it_files_path ,$it_files_name , $path code work correct$it_files_path = $request->file(‘file’);$it_files_name = $it_files_path->getClientOriginalName();$path = $request->file(‘file’)->storeAs(‘uploads’,$it_files_name, ‘public’); $item->it_photo_name =$it_files_name; $item->it_photo_path =$path; $item->it_arabic_name =$request->it_arabic_name; $item->it_english_name .. Read more Environment: Laravel Version: 5.7 PHP Version$ php –version: PHP PHP 7.1.3 (cli) Database Driver & Version $mysql –version: mysql Ver 8.0.23-0ubuntu0.20.04.1 Problem Statement: Unable to dd code to iterate multiples file upload inside Controller. And dd($files) is returning last uploaded file instead file array or object $files =$request->file(‘file’); foreach ($files as$file){ ..