Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get repeater uploaded file in Laravel v5.1 ? #81

Open
awolad opened this issue Jan 15, 2018 · 4 comments
Open

How to get repeater uploaded file in Laravel v5.1 ? #81

awolad opened this issue Jan 15, 2018 · 4 comments

Comments

@awolad
Copy link

awolad commented Jan 15, 2018

I have used form repeater for file upload. Everything is OK. But after submit the form, I am not getting uploaded file info in my Laravel controller.

@sandofvega
Copy link

Stop using this plugin for this reason. 😞

@mrsnax
Copy link

mrsnax commented Oct 10, 2022

no update until now??

@mrsnax
Copy link

mrsnax commented Dec 4, 2022

UPDATED :

I'm using new FormData (<FormRepater>) for file upload

here is an example :


    const form = document.getElementById("form-name");
    const formData = new FormData(form);
    
    window.axios({
	              method: 'post',
	              headers: {'Content-Type': 'multipart/form-data'},
	              url: (CONST_YOUR_URL_HERE),
	              params: { id: $('#id-params').val() },
	              data: formData
	        })
	.then(function (response) {
			console.log(response.data.data_value.id);
		})
	.catch(function (error) {
		console.log(error);
	});
				

I'm using Axios Plug-In, an AJAX replacement

@MusheAbdulHakim
Copy link

if(!empty($request->repeater)){
            $files = [];
            foreach($request->repeater as $key => $file){
                $files [$key]] = $file['file']; //assuming your input name is file
            }
           $files // will now contain all the files uploaded in the repeater and you can do whatever you want with it.
        }

Make sure you have enctype="multipart/form-data" set in your form

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants