1

(14 replies, posted in General discussion)

hi ankitjagetia

sorry but this is probably not going to help you much but i'll say it any way as it was the cause of my problem.

Theres some other javascript on your page thats causing the javascript to error, when this happens, the plupload instance will be undefined, as the javascript stops executing once it hits an error so the plupload scripts do not get run.

All you can do really is to remove plupload from the page and use firebug or something similar to analyze the existing js. and see if there are any  problems with your existing code.

If no problems occur then try running the demo code with php upload on a page on its own, then 1 by 1 add the existing js you have until it breaks, thats pretty much the only way of finding out what other js is causing your conflicts.

It took me a good few hrs, but i found the rough js eventually, good luck.

2

(1 replies, posted in Queue Widget)

Found it out smile

I needed to add to the following:
preinit : {
            UploadFile: function(up, file) {
                up.settings.multipart_params = {
                    "idloc_img" : $('#idloc_img').val(),
                    "ref_img" : $('#ref_img').val(),
                    "name_img" : $('#name_img').val(),
                    "idctg_img" : $('#idctg_img').val(),
                    "order_img" : $('#order_img').val()
                };
            }
        },

3

(1 replies, posted in Queue Widget)

Hi there

I've pretty much got everything working just struggling on one problem

I need to submit information from a form to my upload.php page where it inserts data into the database.

i am using the following to submit the data:

multipart_params : {
     "idloc_img" : $('#idloc_img').val(),
     "ref_img" : $('#ref_img').val(),
     "name_img" : $('#name_img').val(),
     "idctg_img" : $('#idctg_img').val(),
     "order_img" : $('#order_img').val()
},

problem i am having is only the filds that are populated with get varibales on page load are being submited, anything entered on the page after it has loaded isnt getting sent across (their values are empty in firebug) so are not getting inserted into my table.

I am assuming its because the multipart params are set when the script firsat runs and the form fields are empty then, how can i updae the uploader to use entered values after it has initialised?

great piece of kit by the way, only wish the documentation was better, would save me a tonne of time tongue

4

(2 replies, posted in General discussion)

thanks adding the following did the trick

if (!file_exists($finalDir)){
        @mkdir($finalDir);
}

5

(2 replies, posted in General discussion)

Hi there

the uploader is not creating the final destination folder.

First thing i did was check the permissions on the server and everytrhing is ok there. within the seperate cms section i use a diffrent uploader and this functions ok and creates the folder, so permissions are not a problem.


I am passing across the folder name in a get variable when i make the call to the uploader:

$("#uploader").plupload({
        // General settings
        runtimes : 'flash,html5,html4',
        url : 'process upload.php?folder=<?php echo $_SESSION['kt_idugp_usr']; ?>',
        max_file_size : '150mb',
        chunk_size : '1mb',
        unique_names : true,
        multiple_queues : true,

        // Resize images on clientside if we can
        //resize : {width : 320, height : 240, quality : 90},

        // Specify what files to browse for
        filters : [
            {title : 'Allowed files', extensions : 'jpg,jpeg,gif,png,bmp,flv,doc,pdf,zip,dmg,mov,txt,mpeg,wmv,wav,mp3,aiff,inx,indt,qxp,ai,eps,otf,afm,edl,tif,tga,swf'}
        ],

        // Flash settings
        flash_swf_url : '../plupload/js/plupload.flash.swf',

        // Silverlight settings
        silverlight_xap_url : '../plupload/src/javascript/plupload.silverlight.xap'
    });

if the folder exists everything works ok, but if the folder does not exist the file is uploaded to the temp folder and nothing else is done.

i checked in firebug and the folder name is passed across to the process upload.php page ok
(the folder name is numeric referencing a session variable which is the usergroup id)

the net tab of firebug actually shows 4 calls to process upload.php

http://www.mywebsite.com/Client%20Area/ … ?folder=35

the response of each call returns the following:
{"jsonrpc" : "2.0", "result" : null, "id" : "id"}

here is the full process upload.php script i am using:

/**
 * upload.php
 *
 * Copyright 2009, Moxiecode Systems AB
 * Released under GPL License.
 *
 * License: [url]http://www.plupload.com/license[/url]
 * Contributing: [url]http://www.plupload.com/contributing[/url]
 */

    // 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 = $_SERVER['DOCUMENT_ROOT']."/userfiles/tmp"; //temp directory <- need these to be variable
     $finalDir  = $_SERVER['DOCUMENT_ROOT']."/userfiles/".$_GET['folder'].""; //final directory <- need these to be variable
    $cleanupTargetDir = true; // Remove old files
    $maxFileAge = 60 * 60; // Temp file age in seconds

    // 30 minutes execution time
    @set_time_limit(30 * 60);
    // usleep(5000);

    // Get parameters
    $chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
    $chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
    $fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';

    // Clean the fileName for security reasons
    $fileName = preg_replace('/[^\w\._]+/', '', $fileName);

    // Create target dir
    if (!file_exists($targetDir)){
        @mkdir($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))
                @unlink($filePath);
        }

        closedir($dir);
    } 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"}');

                fclose($out);
                unlink($_FILES['file']['tmp_name']);
            } 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"}');


            fclose($out);
        } else
            die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
    }
    //Moves the file from $targetDir to $finalDir after receiving the final chunk
    if($chunk == ($chunks-1)){
        rename($targetDir . DIRECTORY_SEPARATOR . $fileName, $finalDir . DIRECTORY_SEPARATOR . $fileName);
    }

    // Return JSON-RPC response
    die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');

any help appreciated thanks

sorry i canyt give you a test url as the site is live and requires login permissions.

6

(4 replies, posted in General discussion)

no extra info or pointers on where to start for reskinning?

can the flash be reskinned? is ther ann fla file or something we can edit?

where are the css files for the other modules? i am mainly intrested in htlm 4 and 5

Thanks Davit, removing the space did the trick, can't belive i didn't spot that

hi i do have a case online you can test it here:
http://rhtest.base5.eu/Client%20Area/cl … e_test.php

some of the functionality of the other elements might not work as it normally requires a log in, but i have modified the page slightly to allow you to check the functionality.

thnks for your reply
i tried your sugestion

var uploader = $('#uploader').plupload('getUploader');
uploader.refresh()

uploader is undefined

10

(14 replies, posted in General discussion)

Finally got it working,

was not a problem with pl-upload but another script. took ages to find the problem. i was using jquery cycle on the page which for some reason pl-upload did not like, and still dont know why it didnt like it, thanks for your replys, was starange that the error showed up as a pl-upload error and not in the script for the cycle.

Hi been having problems with this, and cant work out how to refresh the uploader.

i have an admin interface where certain panels display are set to hidden and shown using $(#myid').show

after showing a div with the uploader (i am showing and hiding a div that contains the div with the uploader)

the code for my show/hide button

$('#uploadBtn').click(function(){
        $('.admin_button').removeClass('btnOn')
        $(this).addClass('btnOn')
        $('#fileList').hide();
        $('#appList').hide();
        $('#flvGallery').hide();
        $('#uploadArea').show();
        var uploader = $('#uploader').plupload
        uploader.refresh() //dont work
    });

the code for my uploader:

$("#uploader").plupload({
        // General settings
        runtimes : 'flash,html5,browserplus,flash,silverlight,gears,html4',
        url : 'process upload.php',
        max_file_size : '150mb',
        chunk_size : '1mb',
        unique_names : true,
        multiple_queues : true,

        // Resize images on clientside if we can
        //resize : {width : 320, height : 240, quality : 90},

        // Specify what files to browse for
        filters : [
            {title : "Image files", extensions : "jpg,gif,png"},
            {title : "Zip files", extensions : "zip,avi"}
        ],

        // Flash settings
        flash_swf_url : '../plupload/js/plupload.flash.swf',

        // Silverlight settings
        silverlight_xap_url : '../plupload/src/javascript/plupload.silverlight.xap'
    });

    // Client side form validation
    $('form').submit(function(e) {
        var uploader = $('#uploader').plupload('getUploader');

        // Validate number of uploaded files
        if (uploader.total.uploaded == 0) {
            // Files in queue upload them first
            if (uploader.files.length > 0) {
                // When all files are uploaded submit form
                uploader.bind('UploadProgress', function() {
                    if (uploader.total.uploaded == uploader.files.length)
                        $('form').submit();
                });

                uploader.start();
            } else
                alert('You must at least upload one file.');

            e.preventDefault();
        }
    });

my html:

<div id="uploadArea" style="display: none">
            <form  method="post" action="">
                    <div id="uploader ">
                        <p>You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.</p>
                    </div>
                </form>
         </div>

any help greatly appreciated

12

(14 replies, posted in General discussion)

the javascript error tht stops anything else from running is $('#uploader').pluploader is undefined

tried various things but still unable to get it to work, i have a test url for you to look at:
http://rhtest.base5.eu/Client%20Area/cl … loader.php

13

(14 replies, posted in General discussion)

$("#uploader").plupload is not a function
[Break On This Error] flash_swf_url : '/plupload/js/plupload.flash.swf'

"runtimes (flash object) in your case."

i have all the plugins activated it crashes when it reaches the last line of the $('#uploader').plupload block of code, was displaying the silver light as the error before so i removed that line, and so it displays the last line of the code block as the error (now the flash) since i removed the silverlight bit

14

(14 replies, posted in General discussion)

first thing i checked!!! in firebug under the net tab all the scripts are loaded in correctly, is why it makes no sense to me.

the scripts are there and the code is exactly as is in the demo.

must be something conflicting i guess but what i dont know.

am using jquery latest version 1.4.2 there is a lot of other jquery on the page but all that is afyter the code for the plupload and it breaks before reaching that and the page works fine without the plupload code.

i cant give you a test url as its in a password protected area of my clients site.

15

(14 replies, posted in General discussion)

Hope someone can help i'm going crazy tring to work out why this is not working.

i have a page with it working, just the plupload on the page using the jquery ui, exactly as in the example. all good

however when i try to incorporate it into my page it breaks with the following error:
$("#uploader").plupload is not a function
[Break On This Error] flash_swf_url : '/plupload/js/plupload.flash.swf'

anyone else noticed a similar problem??? really need to get this working