since im programming in jquery i forgot javascript so i have to say that this is posible in jquery

yes its posible you must capture onclick event for that button, (im using jquery for that), the other thing im not sure..
see my example for another inplementation … d=764#p764


(17 replies, posted in General discussion)

i had to forget about documentation and search this forum for ideas.. but all worked well in the end, dont get me wrong this is an awesome piece of software, but it was hard to implement with codeigniter, since its a special case, but maybe you could put more examples...


(34 replies, posted in General discussion)

vinoth15 wrote:

Can someone please post an implementation of Codeigniter and plupload?
Please post the controller and view.

well again.. read all thread first, there you can find an implementation

yeah i dont think this plugin is capable yet ..
maybe you could try first compressing the entire folder to a zip, upload it, and then uncompress the file after, you must have knowledge of zip and unzip in php and javascript just an idea...

look at this api at the client side
and this api on the server side
luck pal


(17 replies, posted in General discussion)

well if you dont have all functions documented even we experts have it dificult to deal with it...


(34 replies, posted in General discussion)

YOU MUST READ all tread first, i see maybe you must not use a model move the upload function to the controller ive already answered this..


(2 replies, posted in General discussion)

sorry could you explain a little better your problem i dont understand why you need the file name in dump you said "is it possible to list only the file name on the dump page?"  why it has to be dump? there are other ways of getting the file name
"i want this for insertion into the database however the loop is also listing the upload status and count in the same array" well could you post some code!!!!
once you have the file name is easy to make an insertiion in the db so i dont think you must be looking for the file name in dump i really dont understand, you could use jquery for that

i agree, you should be able to get filename from upload.php it depends how you do it, you should read more of this forum, there is lots of examples there

well i had to hide the Add files button until some data was previously entered using jquery
with   $("#uploader_browse").hide(); an show it with   $("#uploader_browse").show;
something like this


you should first know the selector or id that represents that button there is an icon arrow pointing a rectangle in firebug that lets you select any part of the page and inspect the code, select that button and youll know his id or class smile that easy if you ever used firebug...


(3 replies, posted in General discussion)

why dump?


(34 replies, posted in General discussion)

you must read all thread


(17 replies, posted in General discussion)

and when this as soon as posible would be?


(34 replies, posted in General discussion)

in conclusion using codeigniter jquery and plupload is posible using these techniques, remember we are using MVC in codeigniter

we have the controller upload
the view contains the html, php  and javascript in this case we use jquery instead of javascript
we can call a function in a controller using ajax-jquery
we can controll plupload from jquery, get the name from file, check sucessfully upload, control the % of upload etc
we can pass parameters like the filename using ajax(jquery) to a controller
we can copy, delete, move a file using a controller (php)

we have all to make it work


(34 replies, posted in General discussion)

well this is how i see the process of uploading

1) Call controller upload/do_upload from the view when uploading using ajax, yes from the view, we can use ajax  to "execute" a controller from a view

            // General settings
            runtimes : 'gears,browserplus',
            url : 'upload/get_upload',  //see my controller/function

another example in jquery using the copy function that ive mentioned 

            type: "POST",
            url: "upload/copy_file_to_mypath/",
            data: ({
                myfilename: $filename      //sending parameters like the how to obtain name from my file just uploaded its in the documentation of plupload

            success: function(msg){

2) The file is uploaded succesfully
3) Make an ajax call to copy the file (explained in step 1) to another dir, why ajax? because we are passing in a post parameter the name of the file just uploaded succesfully, to the controller (remembrer we are using javascript for the configuration, well jquery is javascript, read plupload doc about that "controls" the copy if we create this function inside the upload controller the url in the ajax call that points to that function should be upload/copy_file_to_mypath/
4) the controller upload get the file name, in codeigniter is this way $filename = $this->input->post('myparametersentfromajaxcall');
5) build the path where my *.tmp file is located
6) build the path where my *.tmp file should be copied and change the extension in the process
7) executes the copy (still in the controller)
8) after success copy, delete all *.tmp files in tmp dir, this is optional
9) drink a beer smile im gonna drink mine right now


(34 replies, posted in General discussion)

well what happens to my tmp directory if i dont move or delete any file, well it gets full i guess but plupload manages that in the upload configuration

$cleanupTargetDir = true; // Remove old files, look at my code, is false because i need it that way
$maxFileAge = 60 * 60; // Temp file age in seconds,  this  is 1 hour ,if you upload a lot this is too much it depends of your server space

or you could create a function to delete the files in the tmp directory after copying


(34 replies, posted in General discussion)

Well you said that

I succeed to upload my file in the tmp dir

, but instead of moving it why not copy the file to a new directory

but the function doesn't want to move the file because it's not uploaded via HTTP POST.

well i dont think this is related it doesnt matter if you uploaded with ajax, http post or anything else as long as is in a directory you control, you can copy it to any directory in your server as long as you have permissions

which works but it moves the tmp file created by PHP, not the file created by plupload and moreover, the file keeps the *.tmp extension and is unusable.

  eeeehm the tmp file is the image or file the pluging just uploaded you just have to change the extension to jpg if you uploaded an image or in any case the extension depends of what kind of file you just uploaded, well i just created a function  copy_file to copy my file to my custom path and just rename the file.tmp name to my convenience, you have to execute it after a succesfull upload read the plupload documentation

here is the function in php ive created to deal with this but needs a little work off course you must create a controller for this function or add it to the upload controller, for the ajax call to handle for example the url = 'upload/copy_file_to_mypath' , remember that you use javascript for plupload not php

    function copy_file_to_mypath()

        $mypath=$_SERVER['DOCUMENT_ROOT'] . "/erp/docsys/"; // my path in my server read php documentation about $_SERVER['DOCUMENT_ROOT'] 
        if (is_dir($mypath)) {
            //if exists
            mkdir($mypath,0777,TRUE); // create with write permission

        $filename= $this->input->post('hash'); // you must know that the file name is some kind of hash that plupupload creates i use ajax from jquery to send this to the controller , read the plupupload documentation about
        $source = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload" . DIRECTORY_SEPARATOR . $filename . ".tmp";  //well we build our path to the file just uploaded
           $destination = $mypath . $filename . ".myextension"; // myextension wathever i want jpg,doc,xls
           if(copy($source, $destination)) {
              return "ok";
           } else {
              return "Error";

As you can see is the same code from the example but it has a function do_upload in it


class Upload extends Controller {
    function Upload()
        // PROFILER
    function index()

    function do_upload($variable,$nombre)
        // HTTP headers for no cache etc
        header('Content-type: text/plain; charset=UTF-8');
        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
        header("Cache-Control: no-store, no-cache, must-revalidate");
        header("Cache-Control: post-check=0, pre-check=0", false);
        header("Pragma: no-cache");
        // Settings
        $targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
        $cleanupTargetDir = false; // Remove old files
        $maxFileAge = 60 * 60; // Temp file age in seconds
        // 5 minutes execution time
        @set_time_limit(5 * 60);
        // usleep(5000);
        // Get parameters
        $chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
        $chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
        $fileName = $nombre;
        //$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
        //echo $fileName;
        // Clean the fileName for security reasons
        $fileName = preg_replace('/[^\w\._]+/', '', $fileName);
        // Create target dir
        if (!file_exists($targetDir))
        // Remove old temp files
        if (is_dir($targetDir) && ($dir = opendir($targetDir))) {
            while (($file = readdir($dir)) !== false) {
                $filePath = $targetDir . DIRECTORY_SEPARATOR . $file;
                // Remove temp files if they are older than the max age
                if (preg_match('/\\.tmp$/', $file) && (filemtime($filePath) < time() - $maxFileAge))
        } else
            die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
        // Look for the content type header
        if (isset($_SERVER["HTTP_CONTENT_TYPE"]))
            $contentType = $_SERVER["HTTP_CONTENT_TYPE"];
        if (isset($_SERVER["CONTENT_TYPE"]))
            $contentType = $_SERVER["CONTENT_TYPE"];
        if (strpos($contentType, "multipart") !== false) {
            if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
                // Open temp file
                $out = fopen($targetDir . DIRECTORY_SEPARATOR . $fileName, $chunk == 0 ? "wb" : "ab");
                if ($out) {
                    // Read binary input stream and append it to temp file
                    $in = fopen($_FILES['file']['tmp_name'], "rb");
                    if ($in) {
                        while ($buff = fread($in, 4096))
                            fwrite($out, $buff);
                    } else
                        die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
                } else
                    die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
            } else
                die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
        } else {
            // Open temp file
            $out = fopen($targetDir . DIRECTORY_SEPARATOR . $fileName, $chunk == 0 ? "wb" : "ab");
            if ($out) {
                // Read binary input stream and append it to temp file
                $in = fopen("php://input", "rb");
                if ($in) {
                    while ($buff = fread($in, 4096))
                        fwrite($out, $buff);
                } else
                    die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
            } else
                die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
        // Return JSON-RPC response
        die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');

i hope you understand me this is so difficult to explain..


(34 replies, posted in General discussion)

well i must say dont give up, i asure you this works, i have this working in a project im developing right now, so there must be something wrong with the code


(34 replies, posted in General discussion)

try to move the upload code to the controller
and the url in the view shold be
  // General settings
        runtimes : 'flash,gears,html5',
        url : 'upload/do_upload',
        max_file_size : '4mb',

also the target directory is wrong, that is why it gives you permisions problems
$targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
i have it this way in my code
this directory is a temp directory
this is the path with xammp c:/xammp/tmp/plupload
off course if you need it later you can move the file to another directory after the upload

but maybe you can try change it this way

$targetDir = $_SERVER['DOCUMENT_ROOT'] . "/application/uploads/"
or try $targetDir = "../application/uploads/"
google for how to create paths in php maybe is a path related problem and you are not doing it correctly


(34 replies, posted in General discussion)

post your code so we can check it, we need the view and controllers


(34 replies, posted in General discussion)

i forgot that folder must have read/write permission also your user must have … sions.mspx


(34 replies, posted in General discussion)

where did you created your folder? if youre using xampp like me the temp folder should be located in \xampp\tmp\ thats it
the plugin should create a plupload folder there but you can change this in the upload controller (you have the same code i presume)

but if youre in a real server you must be having read write permissions

look at this line
$targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";

but right now im lazy so i dont know how to change it


(34 replies, posted in General discussion)

rawcat wrote:

Hey guys,

I am having trouble with this very same thing. Thanks to geomorillo I found where to change the "?" and "&" to "/". But that still causes problems.

My upload form ist trying to send the file to "uploader/name/abc.jpg"

The Uploader controller is fine but of course it does not know what to do with "name" and "abc.jpg" and neither do I.

I am very new to Codeigniter and plupload and would be really thankful for some help!

off course it will cause problems cause you must follow codeigniter conventions for controllers read the manual … llers.html
so if youre sending variables to the controller you should handle it yourself at least in the index($variable1,$variable2) ???

But i cannot say for sure what your problem is without looking at your code could you post it?


(6 replies, posted in General discussion)

see my response here


(34 replies, posted in General discussion)

ive already figured out how to make it work in codeigniter you must change something  if you see the sorce code from plupload.js

         * Builds a full url out of a base URL and an object with items to append as query string items.
         * @param {String} url Base URL to append query string items to.
         * @param {Object} items Name/value object to serialize as a querystring.
         * @return {String} String with url + serialized query string items.
        buildUrl : function(url, items) {
            var query = '';

            plupload.each(items, function(value, name) {
                query += (query ? '&' : '') + encodeURIComponent(name) + '=' + encodeURIComponent(value);

            if (query) {
                url += (url.indexOf('?') > 0 ? '&' : '?') + query;

            return url;

Did you see the  '&'  and '?' and  '=' replace it for / done it tookme a while to figure this out
Of course i use the minified version of plupload.full.min.js so the changes are

you must change this code:

for this code


well it works for me
Now i got this uploader made with jquery+codeigniter + plupload

if you got any doubts send me an email