1 year ago

Image Intervention changing file upload to multiple files

Posted 1 year ago by Ap3twe

I am using Intervention to upload files. Now I want to have the files upload as an array of files.(multiple) How do I go about it? I tried lab_quote[] but is not working. Or is it best practice to have each file as a separate column in the db?

 if ($request->hasFile('lab_quote')){
        // get file Name
        $quotenameWithExt = $request->file('lab_quote')->getClientOriginalName();
        //The image path and name
        $quotefilename = pathinfo($quotenameWithExt, PATHINFO_FILENAME);
        // get the exxtension
        $quoteextension = $request->file('lab_quote')->getClientOriginalExtension();
        // Name append a time stamp
        $labquotefileNameToStore = $quotefilename.'_' .time(). '.' . $quoteextension;
        // Move the file to the folder
        // $stlpath = $request->file('stl_image')->storeAs('public/uploads', $stlfileNameToStore);
        $qtlpath = $request->file('lab_quote')->storeAs('public/uploads/thumbnails', $labquotefileNameToStore);
        // Resize
        $quote = public_path('storage/uploads/thumbnails'. $labquotefileNameToStore);
        $qto = Image::make($_FILES['lab_quote']['tmp_name']);
$project->fill(['lab_quote' => $labquotefileNameToStore]);

Please sign in or create an account to participate in this conversation.