Welcome Guest, Not a member yet? Register   Sign In
Flash multiple upload doesn't work with CI upload library
#1

[eluser]Unknown[/eluser]
Hi,

I'm trying to do my own multiple file upload form using flash. I have prepared swf and controller.
If my action looks like this:
Code:
public function upload()
{
     move_uploaded_file($_FILES['userfile']['tmp_name'],'./uploads/'.time().$_FILES['userfile']['name']);
}

everything works perfect - the file is uploading.
But when i change action to (http://ellislab.com/codeigniter/user-gui...ading.html):
Code:
public function upload()
{
     $config['upload_path'] = './uploads/';
    
     $this->load->library('upload');
     if ( ! $this->upload->do_upload('userfile'))
     {
        return 0;
     }    
     else
     {
        return 1;
     }
}
it doesn't work any more.

Furthermore second option works fine with HTML form.

I'm a little bit confused.
Any ideas?
#2

[eluser]danmontgomery[/eluser]
What does "doesn't work" mean? Are you using swfupload/have you used the debug feature to see what is failing? Have you checked $this->upload->display_errors()?
#3

[eluser]Unknown[/eluser]
I found solution here.

Flash sends the file with the application/octet-stream mime type, so i get invalid file type error. I didn't use SWFupload, but i tried to do flash uploader myself.

Thanks for help.
#4

[eluser]CroNiX[/eluser]
Dont forget also, that flash doesn't pass your sessionid, so if you are using CI sessions and the session ID changes inbetween one of the uploaded files, it will ruin the session.




Theme © iAndrew 2016 - Forum software by © MyBB