Welcome Guest, Not a member yet? Register   Sign In
uploadify redirect after uploading all files
#1

[eluser]jacobson[/eluser]
Hello, I have a problem with upladify. I managed to make it work properly. My question is how to check in my php code whether the uploading of all files is finished in order to redirect page (refresh to show the uploaded images)

Code:
function index($albumId) {
        if (!empty($_FILES)) {
            //$albumId = $this->uri->sement(2);
            $this->load->library('image_lib');
            
            $tempFile = $_FILES['Filedata']['tmp_name'];
            $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
            $targetFile = str_replace('//', '/', $targetPath) . $_FILES['Filedata']['name'];
            $fileName = $_FILES["Filedata"]["name"];

            move_uploaded_file($tempFile, $targetFile);
            
            echo str_replace($_SERVER['DOCUMENT_ROOT'], '', $targetFile);
            $maxId = 0;
            $q = $this->db->select('MAX(name) as maxid')->get('images');
            foreach($q->result() as $item)
                $maxId = $item->maxid;
          
            $maxId++;
            $newName = $maxId.'.jpg';
            
            $data = array(
                'albumId' => $this->uri->segment(3),
                'name' => $newName
            );

            $this->db->insert('images', $data);
            
            $config = array(
                'source_image' => APPPATH . '../images/uploads/tmp/' . $fileName,
                'new_image' => APPPATH . '../images/uploads/'. $newName,
                'maintain_ration' => TRUE,
                'width' => 500,
                'height' => 400
            );

            $this->image_lib->initialize($config);
            $this->image_lib->resize();
            $this->_create_thumbs($fileName, $newName);
            
            
            unlink(APPPATH . "../images/uploads/tmp/" . $fileName);
        }
    }

thx for help Smile


Messages In This Thread
uploadify redirect after uploading all files - by El Forum - 10-25-2012, 05:09 AM
uploadify redirect after uploading all files - by El Forum - 10-25-2012, 12:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB