Category : file

I have a link for example "https://www.example.com/example-811.jpg" I need to upload it to laravel storage (../app/storage/public/). This is the maximum that I could implement in the controller, everything is fine, but the files are loaded in the TMP extension, how can I load the file in the required format? $filename = ‘example-811.jpg’; $tempImage = tempnam(‘..storageapppublic’, ..

Read more

I am developing a file system management using laravel 8. I created a function that accept file. public function uploadExperiment(Request $request) { $file = $request->file(‘file’); $uniqueId = time(); $fileName = $file->getClientOriginalName(); $filePath = $uniqueId . ‘/’ . $fileName; Storage::disk(‘local’)->put($filePath, file_get_contents($file)); return response()->json(["success"=>true]); } I need to track the uploaded size during the uploading process and ..

Read more

It’s working with inputs and dates puttin’ "value", but don’t with selectboxes and files. edit.blade.php <select type="text" name="Fequency_Id" value="{{$frequencyData->getFrequencyNumber()}}"> <option>Seleccionar</option> @foreach ($frequency as $data) <option value="{{$data->getFrequencyId()}}"> {{$data->getFrequencyNumber()}} </option> @endforeach </select> <input type="file" name="qr_code_machine" value="{{asset(‘storage’).’/’.$machine->getQrCodeMachine()}}"> I’ve testing verifying if they’re empty but it doesn’t work. Sourc..

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 want to upload multiple files in laravel with metadata. Like file custom name and file category. I tried to add some property in frontend using js but I can see them in the controller here the code $(document).on(‘change’,’#file’,function(e){ let file = e.target.files[0] file.totalWords = 1234; file.caytegory = ‘category’; filesList.push(file) }); let mainFormData = new ..

Read more

I’m working with vuejs and want to submit files using axios I try to append files to FormData but it still not working The only thing I know how to do is showing the file’s name <template> <div> <div class="row"> <div class="col-lg-9 col-md-9 col-sm-12"> <div class="form-inline mb-3 pt-3"> <label for="date">Date:</label> <input type="date" name="date" id="date" min=’2020-05-08′ ..

Read more

I have this issue when I try to show the name in my public view {{$boletin->url}} and show me this: [{"download_link":"boletinesDecember2020Hpxj1lGpxXi8f5tTeOld.pdf","original_name":"C_PROCESO_20-12-11135698_250001015_78680742.pdf"}] and I cant download the file recently uploaded. this is my code: url}}” download=”{{explode(‘.’,$boletin->url)[0]}}” class=”btn btn-success”>Descargar the thing is that in the admin voyager show me very good I hope someone can help me ..

Read more

When I run in my local, the image file is shown. But in the production server it is not showing. URL in my local : http://localhost:8000/files/image/GOT7.jpg URL in my production server : http://myApplication.com/files/image/GOT7.jpg .env in the local : APP_URL=//localhost .env in the production server : APP_URL=https://myApplication.com config/filesystem.php ‘disks’ => [ ‘local’ => [ ‘driver’ => ..

Read more

`public function wordExport($ticket_id){ $icon=Ticket::findOrFail($ticket_id)->icon; $contact=Icon::findOrFail($icon->id)->contact; $ticket=Ticket::findOrFail($ticket_id); $wordFile=new TemplateProcessor(‘word/Notice of Intention to Appear.docx’); $name=$contact->first_name." ".$contact->last_name; $wordFile->setValue(‘name’,$name ); $wordFile->setValue(‘address’,$contact->address); $wordFile->setValue(‘province’,$contact->province); $wordFile->setValue(‘postal_code’,$contact->postal_code); $wordFile->setValue(‘ticket_no’,$ticket->ticket_no); $wordFile->setValue(‘icon_code’,$ticket->icon_code); $wordFile->setValue(‘date’,$icon->date); $wordFile->setValue(’email’,$contact->email); $wordFile->setValue(‘city’,$contact->city); $wordFile->setValue(‘phone’,$contact->phone); $wordFile->setValue(‘currentDate’, date("Y-m-d")); $wordFile->setImageValue(‘ticketimage’,array(‘path’ =>public_path().’/uploads/file/’.$ticket->images_name , ‘width’ => 600, ‘height’ => 900, ‘ratio’ => true)); $wordFile->setValue(‘interpreter’,$icon->interpreter); $fileName=$contact->first_name.date("mdY").time(); $wordFile->saveAs($fileName.’.docx’); return response()->download($fileName.’.docx’)->deleteFileAfterSend(true); } ` this code generate a word file but I want ..

Read more

i’m triyng to get original File object back from base64 content. the method i’m using is private function _base64ToImage($base64_string, $locationId) { $output_file = storage_path() . "/app/public/uploads/locations/my.jpg"; $file = fopen($output_file, "wb"); $data = explode(‘,’, $base64_string); fwrite($file, base64_decode($data[1])); fclose($file); return $output_file; } i know this is not the way. i don’t want to fopen or fwrite anything. ..

Read more

I try to upload file inside my /public/images/profils directory but, i don’t know why, it’s not working ! this is my controller function : if ($request->hasFile(‘image’)) { if ($request->file(‘image’)->isValid()) { $validated = $request->validate([ ‘image’ => ‘mimes:jpeg,png|max:2000’, ]); $extension = $request->file(‘image’)->extension(); $name = uniqid(‘img_’); $request->file(‘image’)->storeAs(‘/public/images/profils’, $name.’.’.$extension); } } When i check on the folder, no file ..

Read more

I’m new to Laravel. I can do normal addition. But I cannot add files. What is the problem? blade.php {!!BootForm::open([ ‘method’ => ‘POST’, ‘route’ => ‘admin.companies.postCreateCompany’, ‘files’=> ‘true’])->enctype(‘multipart/form-data’) !!} {!!BootForm::text(‘Company Name’, ‘company_name’, null, [‘required’ => ”, ‘placeholder’ => ‘Company Name’])!!} {!!BootForm::text(‘Name’, ‘owner_firstname’, null, [‘required’ => ”, ‘placeholder’ => ‘Name’])!!} {!!BootForm::text(‘Lastname’, ‘owner_lastname’, null, [‘required’ => ”, ..

Read more

I have a form to get the file from the user and I validate the file format with the following rule: $valid = validator($request->only([‘files’],[ ‘files’ => [‘nullable’, ‘array’], ‘files.*’ => [‘mimes:zip,rar,jpeg,jpg,png,txt,doc,docx,pdf’,’max:25600′] ]); As you can see, I said accept text files as well. But I want to accept only text/plain files. But for example, it ..

Read more

I want to save uploaded file to ‘/home/user/images’ folder. Is there any way to do this? My 1st try: controller public function save(Request $request) { $file = $request->file(‘image’); $file_name = $file->getClientOriginalName(); $file_path = ‘/home/user/images’; $file->move($file_path, $file_name); } ///////////////////// My 2nd try: filesystems.php ‘disks’ => [ .. ‘custom_folder’ => [ ‘driver’ => ‘local’, ‘root’ => ‘/home/user/images’, ..

Read more

I have a problem making the files downloadable after unzipping. And show in blade table with name of file, size of file and download button. Name and size is done in foraach. Problem is how to make the file downloadable. Error: Cannot use object of type SymfonyComponentHttpFoundationBinaryFileReponse as Array in page.blade.php Firstly ZipArchive extension: $ziparchive ..

Read more

Below is the example i’ve used to download files but it only opens file in the next tab. it does not downloads files. function download(items) { items.forEach(function (item, index) { // console.log(item); var anchor = document.createElement(‘a’); anchor.href = item.url; anchor.target = ‘_blank’; anchor.download = item.name; anchor.innerHTML =’download’; setTimeout(function () { // console.log(anchor); anchor.click(); }, index ..

Read more