Category : file-upload

I’m trying to upload multiple images in Laravel using Intervention image package, it works fine with single image, when i try to upload multiple images it show empty list. Postman request : enter image description here Controller function: public function updatePosters(Request $req ) { $category = Category::where(‘id’, $req->id)->first(); if ( $req->hasFile( ‘images’ ) ) { ..

Read more

Getting error while updating existing image file on the edit page. on create page, it’s working fine. how can I get upload file info without clicking on onchange function? on create page on edit page On Php file if($request->get(‘img’)) //image upload { $image = $request->get(‘img’); $name = time().’.’ . explode(‘/’, explode(‘:’, substr($image, 0, strpos($image, ‘;’)))[1])[1]; ..

Read more

I am struggling with a weird problem. I am trying to upload a file to a different server using the API. I am using Laravel 8.X and Using HTTP client for the same. Below is my code which I am calling from a controller if ($request->hasFile(‘uploadReceipt’) && $request->file(‘uploadReceipt’)->isValid()) { $receiptContent = file_get_contents($request->file(‘uploadReceipt’)); $originalName = $request->file(‘uploadReceipt’)->getClientOriginalName(); ..

Read more

here is my code, how I am uploading to storage and retrieving files. Maybe I am doing it all wrong. $uploadedFileUrl = request()->certificate_template->store(‘public/certificate’); return url(asset(‘storage/certificate/’.str_replace(‘public/certificate/’,”,$uploadedFileUrl))); Well, I have to upload it to the public/certificate but to get it from storage I have to use storage/certificate. Please help. Is there any other method I can get ..

Read more

I’m faced a problem since yesterday in my laravel projet. I have a input file and the file is uploaded in the forder storage/app/public/uploads. Now when i want to show the file I have this message: "Access forbidden! You don’t have permission to access the requested directory. There is either no index document or the ..

Read more

There is a table house. It has four columns (where the path to the downloaded file should be saved). I tried to download one file in the controller for the test, but it did not appear in the database $this->validate($request, [ ‘passport’ => ‘required’ ]); $homes = Houses::query()->create([ ‘passport’ => $request->get(‘passport’) ] ); $request->validate([ ‘file’ ..

Read more

I am getting the error "call to a member function documents() on boolean" as I am trying to get the filename of the uploaded document for a card. I have created a relationship between Cards and CardDocuments: Cards.php: public function documents() { return $this->hasMany(CardDocuments::class); } CardDocuments.php: public function files() { return $this->belongsTo(Card::class, ‘card_id’); } After ..

Read more

Using Laravel 5.4 I’m trying to submit a form with a file to upload with ajax. My jquery code: $("#uploadRoastsForm").submit(function() { var url = $(this).attr(‘action’); var fd = new FormData(); var files = $(‘#roastFile’)[0].files; if(files.length > 0) fd.append(‘file’, files[0]); fd.append(‘file’, files[0]); fd.append(‘roast_date’, $(‘#roastDate’).val()); $.ajax({ url: url, type: ‘POST’, data: fd, contentType: false, processData: false, success: ..

Read more

I am uploading images using Laravel S3, the upload works, but when I checked the image, I get a white square image: I am getting the image from an external website. This is my code: $response = Storage::disk(‘s3’)->put("/directory/image.png, "https://externalwebsite/image.png?token=123", [ ‘visibility’ => FilesystemContract::VISIBILITY_PUBLIC, ‘StorageClass’ => ‘INTELLIGENT_TIERING’, ]); Any tips on what I’m doing wrong? Thanks! ..

Read more

This is my blade — <!– Page Content –> <div class="content" id="app"> <!– Lock Forms –> <!– <h2 class="content-heading">Add User</h2> –> <!– Register Forms –> <div class="row"> <div class="col-md-12"> <!– Bootstrap Register –> <div class="block block-themed"> <div class="block-header bg-gd-dusk"> <h3 class="block-title">Add Cashout Details</h3> </div> <div class="block-content"> @include(‘errors.error’) {{– <form action="{{ route(‘cashoutdetails.store’) }}" method="post" enctype="multipart/form-data" autocomplete="off"> ..

Read more

I’m trying to upload an image file to the database. But, when it posted, it shows a full path of the image file (I use the getClientOriginalName() to get the filename). DSController.php public function createDS2(Request $request) { //dd($request->all()); $imgName1 = $request->file(‘opsi_a’)->getClientOriginalName() . ‘-‘ . time() . ‘.’ . $request->file(‘opsi_a’)->extension(); $imgName2 = $request->file(‘opsi_b’)->getClientOriginalName() . ‘-‘ . ..

Read more

Error Received exception: "ErrorException" file: "/var/www/website/app/Http/Controllers/APIV2.php" line: 1909 message: "file_get_contents(/var/www/website/upload/awBr8Qx_460svvp9_1614090495.webm): failed to open stream: No such file or directory" trace: [{function: "handleError", class: "IlluminateFoundationBootstrapHandleExceptions", type: "->"},…] Server Code public function FileUpload(Request $request){ $file = $request->file(); $filenameWithExt = $file->getClientOriginalName(); $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME); $extension = $file->getClientOriginalExtension(); $fileNameToStore = $filename.’_’.time().’.’.$extension; $path = $file->storeAs(‘/var/www/website/upload’, $fileNameToStore); dd(file_get_content($path)); $name = ..

Read more

please don’t close this. I need help. I have js function for uploading image with tinymce, and route on backend: tinymce.init({ selector:’#{{ $elementId }}’, content_css: "{{ asset(‘css/tiny.css’) }}", width: ‘100%’, height: 600, plugins: [ ‘lists preview hr anchor pagebreak link image wordcount fullscreen directionality paste textpattern table code’ ], extended_valid_elements: ‘svg[*],defs[*],pattern[*],desc[*],metadata[*],g[*],mask[*],path[*],line[*],marker[*],rect[*],circle[*],ellipse[*],polygon[*],polyline[*],linearGradient[*],radialGradient[*],stop[*],image[*],view[*],text[*],textPath[*],title[*],tspan[*],glyph[*],symbol[*],switch[*],use[*]’, toolbar: ‘undo redo | ..

Read more

I have a problem for many file uploads with the request structure for the file variables in an array. the following is the code snippet. i need a solution for this, thanks $cimage = count($request->variant[$loop][‘img’]); for($loops1 = 0; $loops1 < $cimage; $loops1++) { $variantImage = $request->file($request->variant[$loop][‘img’][$loops1]); $nameVariantImage = $variant->id . ‘-‘ . date(‘ymdHis’) . ($loops1 ..

Read more

I am trying to get the exact uploaded image size by using getimagesize() php helper on Laravel 7. But i get an error ErrorException: Undefined property: IlluminateHttpUploadedFile::$name on the line where the code is: if($request->file(‘image’) != null){ $upload = $request->file(‘image’); $sourceProperties = getimagesize($upload->name); Please help understand the issues since it only occurs on the Debian ..

Read more