Category : file

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

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); ..

Read more

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

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 ..

Read more

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 = ..

Read more

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 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..

Read more

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){ ..

Read more

I am developing a project with Laravel. My directory structure on cPanel is as shown below. – company-app (folder) – company-files (folder) – public_html — company.domain.com (subdomain) I moved all Laravel files except public folder to "company-app" folder. I wanted to exclude it from the document root for security purposes. Apart from these, there are ..

Read more

laravel include(/home/u25879/domains/lola.com.mx/subdominio/vendor/composer/../../App/cla/pg.php): failed to open stream: No such file or directory this error appear only on the server when I want to call an specific class function from the controller. enter code"require": { "php": "^7.3", "aprendible/storage-link-route": "^1.0", "doctrine/dbal": "^2.10", "fideloper/proxy": "^4.2", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", "intervention/image": "dev-master", "laravel/framework": "^8.0", "laravel/tinker": "^2.0", "laravel/ui": "^3.0", "milon/barcode": "^8.0", ..

Read more