How to validate array of files in Laravel? [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 months ago.
Improve this question
I'm working on a project where every user is able to add multiple product images. I'm using a single form to submit the product which does 2 things in ProductController#store which are creating new product + creating images belongs to this product in Images table.
The important part is that I want to allow users to upload total of 10mb of images per product. So mainly I want to validate total files size of the array of images the user trying to update.
I found this solution: Laravel Validate Array of Files Total Allowable Upload Size
This solution is almost 5 years old so I was wondering if there is an easier way, or a more straight forward way to accomplish this?

I have mixed the stackoverflow solution with Laravel's custom validation rule which solved my problem with a modern solution.
https://dev.to/moose_said/create-custom-laravel-validation-rule-for-total-uploaded-files-size-1odb

Related

add multiple PDF files to wordpress post or page [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I need some help with wordpress, I'm not too experienced with it, and I need to add multiple pdf to the post/page edit screen back-end and display then the added files on the front-end to let the user download them. I've found this article but I'm not sure if this is the way to follow, I will not know the labels and I'm not sure if inside a custom metabox is possible to create dynamic fields (add more fields like label and file if needed). I don't want to use a bloated plugin, how I can proceed?
The easiest way to do this is upload the PDF using the media uploader and then linking them in the frontend while creating a post.
A simple sample at - https://www.wpmadesimple.org/supplementary-guides/adding-pdf-documents/
Let me know if you need more help. This is without a plugin, though there might be more solutions like CPT/Plugins but that is based on your needs.

How to Add Product in Code Igniter Cart with different Size? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a client who needs an E-Commerce site for his Foam Manufacturing Company. I am making this project using Code Igniter.
Here I have a problem. Each Foam has its own custom cutting. For example we need L Shape foam so we have to calculate length,width and Side Length. If we have square shape then we need to measure Width and Height. If we have O shape we need Radius.
I am confused that how I put all this in one Cart. Is this possible to get different Product's with different options and Sizes?
Secondly tell me how can I get all these product's from DB? Because it is not possible for me to get this multiple type of data from DB.
Please help me I am so confused. I have running Short of Time.

I need to create a database structure that will do the following [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
i want to be able to upload multiple images (i got this working) its array
only problem is i need each image to have its own content but i want to use one form as this relates to a specific article.As you see this picture
This welcome article for example has a heading, an image and text to explain for each image .
this is my current db structure but as you can see there is no way content will be separate for each image
article id is the foreign key
How could i achieve this in a database structure?
You talking about uploading images to your server right ? if so:
You got few options to do it:
Create a 'unique' id and put them inside the image element and the content element.
Then you will get two arrays and you combine them by the unique.
Almost the same, just simply to store the content and the images inside arrays. and just loop through them and 'combine' them by the array's id. because you inserting the same amount so it should be the same. But answer 1 is safer here.

Uploading multiple image how to store them [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Okay so I am doing this project and i need to allow the user the ability to upload 6 images, how should i go by doing this on the database side of things.
Make a column for each image
Store it in one column as an array and then do the processing of the array with PHP?
I will be useing the Yii Framework and also MySQL as a database engine.
I know how to upload file and store it to a directory and the other needed things, just not sure what to tackle the problem.
EDIT: My final goal is to have this index page edited by one user (Admin) and I want him to allow him to edit the images and the current offers as well.
You should create table user_images beacause:
You can change number of images pef user in the future without changing database
You can easily display all images in GridView and easly generate CRUD for user images.
You can easily store versioned list of images for user.
Implementation and code reusable will be simplier.
You should create a new table called "user_images(id, user_id, image_url)" to store image.

Preserving text formatting for dynamic website [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am facing a problem while creating a dynamic website. I am building it for some pharma company, which have many products. The problem is, every product have different sections of description, and have to be formatted differently. I wanted to store all the product descriptions in the database, but at the same time preserve the formatting of each description. I also plan to provide an admin interface, where they could edit the product information themselves.
I could use Joomla or any other CMS for that purpose, but i wanted to know if i want to build such a system of my own, where i could format the text in an editor and them save that thing into database and when i retrieve it, i get the same formatting. How could i do this?
Also i wanted to do this in PHP.
Thanks
-- Mohit
Just use a WYSIWYG editor like ckEditor or TinyMce. That will handle the text formatting.. then you jsut store in your database.

Categories