Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am actually trying to modify Ziinloader answer from jQuery Ajax File Upload

so that i can send more submitted data

From his example form data are initialize in this way

var formData = new FormData($('#form_image')[0]);

So in the method to handle file upload ( codeigniter ) I could just simply get everything in $_FILES["file"]

But now inorder to submit more data I am using "community wiki suggestion" jQuery Upload Progress and AJAX file upload

var formData = new FormData;
formData.append('photo1', $('#form_image')[0]);
formData.append('data2','data2value');

So now in codeigniter file upload method handler I can get these values by

$this->input->post("photo1");
$this->input->post("data2");

But how to actually get $_FILES["file"] out of $this->input->post("photo1");

and yeah if i print_r($this->input->post("photo1")) and if I console.log(data) in the success handler of the ajax it will shows this [object HTMLFormElement]

just in case if its needed here is my form code

<form id="form_image"><input type="file" class="file" name="file" /></form>
share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.