Category : file-upload

I try to create a simple file upload with Vuejs and Laravel. But my ‘b2b_file’ variable seems to be null. in Vue component I have: <b-form-file v-model="b2b_file" name="b2b_file" multiple > </b-form-file> methods: { this.b2b_file.map(element => { this.productData.b2b_file.push(element) }) } console.log(this.productData.b2b_file) returns the fallowing: https://prnt.sc/1hox1c5 Due to the path being empty in my controller when I ..

Read more

$data = Student::find($id); $filePath = $data[‘photo’]; unlink($filePath); $filepath hold a value like this – storage/other-document/images-1/jj.png ,because am storing the file jj.png inside the folder images-1. images-1 is a custom created folder. The unlink function here deletes the file from this images-1folder . but i want the images-1 folder also to get deleted along with this. ..

Read more

I allowed many file extensions: array(‘jpg’,’png’,’gif’,’jpeg’,’txt’,’doc’,’docx’,’pdf’,’ppt’,’pptx’,’xls’,’xlsx’,’csv’,’json’,’msg’,’zip’,’rar’,’pkpass’,’eml’) However, I am getting this error for only XLS files: {"status":"error","code":1089,"reason":"Malicious file passed"} By the way, it’s not the case for XLSX files. Can you help me to fix it? Thanks in advance. Sourc..

Read more

I am getting null while I tried to upload multiple images in Laravel 8. In Blade: <form method="POST" action="{{ url(‘admin/add_images/’.$album_id.’/save’) }}" enctype="multipart/form-data"> <input name="image_name[]" type="file" accept="image/*" multiple> In Controller function save_image(Request $req, $id) { $gallery = new GalleryImage(); return $req->file(‘image_name’) ; } I browse 2 images and upload. I got this output Sourc..

Read more

I got an error in laravel 8, while uploading multiple images. Argument 1 passed to IlluminateDatabaseGrammar::parameterize() must be of the type array, string given, called in C:xampphtdocslaravel_cmsvendorlaravelframeworksrcIlluminateDatabaseQueryGrammarsGrammar.php on line 886 Here is my code in controller: $gallery = new GalleryImage; foreach( $req->file(‘image_name’) as $image) { $upload_image_name = time().’_’.$image->getClientOriginalName(); $image->move(‘uploads’, $upload_image_name); $name[] = $upload_image_name; } $gallery->image_name ..

Read more

I’m trying to validate the file upload on my project but it always return a file size exceeds error. Please see my code below. Validation $request->validate([ ‘attachments.*.file’ => ‘file|max:60000’ ]); Input field <div class="col pr-0"> <label>Attach File</label> <input name="attachments[0][file]" type="file" class="form-control-file"> </div> Error print @error(‘attachments.*.file’) <div>Some attached files exceeds the maximum upload limit</div> @enderror Source: ..

Read more

I tried to upload files into firebase storage. here is the file upload code public function storeFiles(Request $request){ try{ $image = $request->file(‘file’); $extension = $image->getClientOriginalExtension(); $filename = microtime(). ‘.’ . $extension; app(‘firebase.storage’)->getBucket()->upload($image, [‘name’ => $filename]); return "Uploaded Success"; }catch(Exception $e){ return $e->getMessage(); } } fie was uploaded without error but files are not working. file ..

Read more

I’ve Laravel 5.6 application that makes the API for mobile app. The app needs to upload multiple images and it sends a post request with an image array as below. each image has an index. {"images": [{"image_index": 0, "profile_image": "iVBORw0KGgoAAAANSUhEUgAAD8AAAAvQCAIAAABPl1n3AAABYWlDQ1BrQ0dDb2xvrnclNwYWNlRGlzcGxheVAzAAAokWNgYFJJLCjIYWFgYMjNKykKcndSiIiMUmB/yMAOrnhLwMYgwKicnFBY4BAT5AJQwwGhV8u8bACKIv64LMOiU1tUm1XsDXYqbw1YuvRJswrn1aMArpTU4mQg/Qe"} {"image_index": 1, "profile_image": "iVBORw0KGgoAAAANSUhEUgAAD8AAAAvQCAIAAABPl1n3AAABYWlDQ1BrQ0dDb2xvrnclNwYWNlRGlzcGxheVAzAAAokWNgYFJJLCjIYWFgYMjNKykKcndSiIiMUmB/yMAOrnhLwMYgwKicnFBY4BAT5AJQwwGhV8u8bACKIv64LMOiU1tUm1XsDXYqbw1YuvRJswrn1aMArpTU4mQg/Qe"}]} my Laravel code like $destinationPath = public_path(‘/profile_images/’); foreach ($request->images as $items) ..

Read more

I am uploading files to AWS S3 from Laravel using the Flysystem package. I deploy the application on Elastic Beanstalk. But the deployment is getting failed and producing the following error: [ERROR] An error occurred during execution of command [app-deploy] – [Install composer dependencies]. Stop running the command. Error: chown /var/app/staging/vendor/aws/aws-sdk-php/tests/Credentials/testlink: no such file or ..

Read more

A script I got from Code canyon, I installed it on IIS. fails when uploading files via script. I tried many ways, but failed. I edited request filters, edited php.ini, edited file permissions but couldn’t find the problem, does anyone have an idea Error laravel.log ; [2021-06-30 09:09:48] local.ERROR: fopen(): Filename cannot be empty {"userId":9,"exception":"[object] ..

Read more

On Windows I have Xampp. My application is in Anuglar and Laravel 8 I add files to folder public in storage folder. Configuration in filesystem.php: ‘public’ => [ ‘driver’ => ‘local’, ‘root’ => storage_path(‘app/public’), ‘url’ => env(‘APP_URL’).’/storage’, ‘visibility’ => ‘public’, ], In .env file: APP_URL=http://localhost:8082/prftbx-crm-api/public File in public folder: Directory of C:xampphtdocscrm-apistorageapppublic 06/25/2021 11:01 AM ..

Read more

I am trying to upload a file (PDF document) using Laravel. However I am keep on getting the below error: file_get_contents(/tmp/phpQcAqB6): failed to open stream: Permission denied Below I have provided a dump of the IlluminateHttpRequest object, this is what is getting passed into my controller when uploading the document: Array ( [file] => /tmp/phpQcAqB6 ..

Read more

in my application, I am trying to upload one same file to two different paths inside a foreach loop. but it uploads the file to the first location and when uploading to the other it throws the below error. "The file "image.jpg" was not uploaded due to an unknown error." below is my controller function: ..

Read more

i have a product and i want it to have multiple file, so i made a oneToMany relation between product and images model. i was able to upload image successfully public function uploadFile(Request $request) { if($request->hasFile(‘images’)) { foreach($request->file(‘images’) as $file) $file->store(‘public/images/’. $file->getClientOriginalName()); } return $request->file(‘images’); } now images are storage into storage/public/~ i want to ..

Read more

i have a product and i want it to have multiple file, so i made a oneToMany relation between product and images model. i was able to upload image successfully public function uploadFile(Request $request) { if($request->hasFile(‘images’)) { foreach($request->file(‘images’) as $file) $file->store(‘public/images/’. $file->getClientOriginalName()); } return $request->file(‘images’); } now images are storage into storage/public/~ i want to ..

Read more

This is what i have done to upload my file into in laravel project. if($request->file()) { $fileName = time().’_’.$request->file(‘imageFile’)->getClientOriginalName(); $filePath = $request->file(‘imageFile’)->storeAs(‘products’, $fileName, ‘public’); $product->featured_image = ‘/storage/’ . $filePath; } public disk ‘public’ => [ ‘driver’ => ‘local’, ‘root’ => storage_path(‘app/public’), ‘url’ => env(‘APP_URL’).’/storage’, ‘visibility’ => ‘public’, ], The file uploaded in storage folder inside ..

Read more