Welcome Guest, Not a member yet? Register   Sign In
Problems with PHP response to flash uploader
#1

[eluser]brainer[/eluser]
so...

I have successfully gotten image uploads and resize to work with the class from this post:
http://ellislab.com/forums/viewthread/70979/

But I'm facing some issues

What should happen:

My (custom) flash uploader should read a response from PHP and then in turn call a JS function, which will display the newly uploaded image.

What happens:

The flash does not always (but does occassionaly) read the response, so the js function isn't called - even though the image does get uploaded, resized and the image info gets stored in the database.

What I've tried

I've changed the way the echo back is structured (with varying results). I've tried things like
Code:
echo 'varback1=$pieceid&varback2;=$rawname';
echo '?varback1=$pieceid&varback2;=$rawname';
echo '&varback1;=$pieceid&varback2;=$rawname';
echo 'xx=xx&varback1;=$pieceid&varback2;=$rawname';

I've played around with ini_set("memory_limit")

I've loaded the libraries and models in different places

I've also created a testing html upload form which directs the image to the same controller which works perfectly, the image uploads, gets resized, and the image info is stored. But unlike when i upload in flash, i can see the echoed response on the upload page.

I've been stuck on this for nearly 3 days now (12+ hours per day!), but still no joy.. + I've tried everything i can think of. It's such a strange error.

I'm really hoping one of you guys have come across something similar before.

Do you think it could be possible that CodeIgniter is trying to redirect to an error page, which causes no response to be echoed? If so, is there any way for me to see that error?


This is my controller:

Code:
function ddPieceUploaderImage()
    {
        $this->load->model('portfolio/piece_model');
        
        $userid = $this->input->post('Name');
        $folderid = $this->input->post('var1');
        $projectid = $this->input->post('var2');
      
        // set up some stuff for the uploader
        $aCfg = array();
        $aCfg['upload_path']      = '../../folder/media/image/';
        $aCfg['allowed_types'] = 'gif|jpg|jpeg|png';
        $aCfg['max_size']        = '2000';
        $aCfg['encrypt_name']    = TRUE;
        $aCfg['is_flash_upload'] = TRUE; // i do have a flash-upload with application/octet-stream instead of image/jpg
        //echo "4";
        $this->upload->initialize($aCfg);
        //echo "5";  

            
        // filedata is the name of the file-input field / ie. form
        if ( $this->upload->do_upload('Filedata') == FALSE )
        {
            // there is an error when uploading the file
            log_message('error', 'Flas Upload: error uploading the image: '.$this->upload->display_errors());
            echo "error";
        } else {
            $fInfo = $this->upload->data();
            $rawname                 = $fInfo['raw_name']; // name of file without extension
            $data['piecetypeid']     = 1; // 1 = image
            $data['userid']             = $userid;
            $data['projectid']         = $projectid;
            $data['position']         = $this->piece_model->getNextPosition($projectid); // get next piece position
            $data['url']             = $rawname;
            $data['title']             = $fInfo['orig_name']; // to do
            $data['datetime']         = time();
            $pieceid                 = $this->piece_model->addPiece($data,$userid); // get next piece position

            $this->_createLargeImage($fInfo['file_name'], $fInfo['raw_name'], $fInfo['file_ext']);
            //80x80 thumb
            $this->_createThumb($fInfo['file_name'], $fInfo['raw_name'], $fInfo['file_ext'],$fInfo['image_width'],$fInfo['image_height'],80);
            //132x132 thumb
            $this->_createThumb($fInfo['file_name'], $fInfo['raw_name'], $fInfo['file_ext'],$fInfo['image_width'],$fInfo['image_height'],132);
            //272x272 thumb
            $this->_createThumb($fInfo['file_name'], $fInfo['raw_name'], $fInfo['file_ext'],$fInfo['image_width'],$fInfo['image_height'],272);
            //406x180 folder thumb
            $this->_createThumb($fInfo['file_name'], $fInfo['raw_name'], $fInfo['file_ext'],$fInfo['image_width'],$fInfo['image_height'],406, TRUE);
            //406x180 rollover thumb
            $this->_makeRollOverThumb($fInfo['file_name'], $fInfo['raw_name'], $fInfo['file_ext'],$fInfo['image_width'],$fInfo['image_height']);            
            echo "varback1=$pieceid&varback2;=$rawname";
        }
    }


Messages In This Thread
Problems with PHP response to flash uploader - by El Forum - 08-22-2009, 01:15 PM
Problems with PHP response to flash uploader - by El Forum - 08-23-2009, 12:25 PM
Problems with PHP response to flash uploader - by El Forum - 08-23-2009, 03:43 PM



Theme © iAndrew 2016 - Forum software by © MyBB