Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

CheckScript
  • Hi There,

    i want to let uploadify check if a file i already on the server or not. So I implemented uploadify like this:

    <script type=\"text/javascript\" src=\"source/uploadify/jquery-1.3.2.min.js\"></script>
    <script type=\"text/javascript\" src=\"source/uploadify/jquery.uploadify.js\"></script>
    <script type=\"text/javascript\">

    $(document).ready(function() {
    $('#upload').fileUpload({
    'uploader': 'source/uploadify/uploader.swf',
    'script': 'source/uploadify/upload.php',
    'checkScript' : 'source/uploadify/check.php',
    'folder': 'source/banners',
    'cancelImg': 'source/uploadify/cancel.png',
    'multi' : true,
    'auto' : true,
    'buttonText' : 'DURCHSUCHEN',
    'displayData' : 'percentage',
    'onComplete' : function(event, queueID, fileObj, response, data) {
    $('div#status').append(\"Datei hochgeladen: \" + fileObj.name + \" <br />\");
    }
    });
    });

    </script>


    But now the upload does not start. I'm using the uploadify check.php. Now, can you tell me what I'm doing wrong?

    Thanks and greetings
    daniel
  • Hi battlewizz,

    I just checked your code and it worked fine for me, but of course I couldn't check your paths - so doublecheck them and also check the id of the FileUpload in the input


    <input name=\"fileUpload\" id=\"upload\" type=\"file\" />
  • Hi,

    thanks for the quick reply. I checked the paths but they are all correct. I can open the check.php if i paste the path into my browser adress bar. But that does'nt stop the script from not working. :(

    Here's the html I'm using right now:

    <body>

    <h1>foo bar</h1>

    <div id=\"uploadbox\">
    <input name=\"fileUpload\" id=\"upload\" type=\"file\" />
    </div>

    <div id=\"status\"></div>

    </body>


    battlewizz
  • Try adding the onError sample code I posted to the thread "Some questions". It will output the starting folder your relative path needs to start from.
  • Okay, i added the onError-Code from your post, but the results stay the same. There is no alert triggered and the script stops with this screen: image.
  • What is your HTML element code?
  • TravisN. said:
    What is your HTML element code?


    This is all the Code there is:

    <html>

    <head>

    <title>Upload-Test</title>

    <script type=\"text/javascript\" src=\"source/uploadify/jquery-1.3.2.min.js\"></script>
    <script type=\"text/javascript\" src=\"source/uploadify/jquery.uploadify.js\"></script>
    <script type=\"text/javascript\">

    $(document).ready(function() {
    $('#upload').fileUpload({
    'uploader': 'source/uploadify/uploader.swf',
    'script': 'source/uploadify/upload.php',
    'checkScript' : 'source/uploadify/check.php',
    'folder': 'source/banners',
    'cancelImg': 'source/uploadify/cancel.png',
    'multi' : true,
    'auto' : true,
    'buttonText' : 'DURCHSUCHEN',
    'displayData' : 'percentage',
    'onComplete' : function(event, queueID, fileObj, response, data) {
    $('div#status').append(\"Datei hochgeladen: \" + fileObj.name + \" <br />\");
    },
    onError: function (a, b, c, d) {
    if (d.status == 404)
    alert('Could not find upload script. Use a path relative to: '+'<?= getcwd() ?>');
    else if (d.type === \"HTTP\")
    alert('error '+d.type+\": \"+d.status);
    else if (d.type ===\"File Size\")
    alert(c.name+' '+d.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB');
    else
    alert('error '+d.type+\": \"+d.text);
    }
    });
    });

    </script>

    <style>
    body {
    font: 12px/18px Arial, Helvetica, sans-serif;
    }
    .fileUploadQueueItem {
    font: 11px Verdana, Geneva, sans-serif;
    background-color: #F5F5F5;
    border: 3px solid #E5E5E5;
    margin-top: 5px;
    padding: 10px;
    width: 300px;
    }
    .fileUploadQueueItem .cancel {
    float: right;
    }
    .fileUploadProgress {
    background-color: #FFFFFF;
    border-top: 1px solid #808080;
    border-left: 1px solid #808080;
    border-right: 1px solid #C5C5C5;
    border-bottom: 1px solid #C5C5C5;
    margin-top: 10px;
    width: 100%;
    }
    .fileUploadProgressBar {
    background-color: #0099FF;
    }
    </style>

    </head>

    <body>

    <h1>foo bar</h1>

    <div id=\"uploadbox\">
    <input name=\"fileUpload\" id=\"upload\" type=\"file\" />
    </div>

    <div id=\"status\"></div>

    </body>

    </html>



    battlewizz
  • This one's has me stumped. I recreated the folder structure you have used, and I was able to upload multiple files without a problem. My only thought is server settings. Check this post http://www.uploadify.com/forum/viewtopic.php?f=7&t=13.
  • To be honest, I don't think that this has something do do with the server settings you mentioned. The thing is, if I delete the checkScript Option from the Code, the upload works perfectly fine, and I'm able to upload as many files at the same time as i want. But then I can't check if the files already exist...
  • If you download the "Uploadify Sample Collection" from the downloads section, and run the second sample down do you still get the error?
  • I just tested putting in a wrong path into the checkScript option, and I get the same result you are experiencing. Do one or two things.

    1. Double check your relative paths
    2. Compress you folder structure including all js, css etc files, attach it to a post and I'll have a look.
  • TravisN. said:
    If you download the "Uploadify Sample Collection" from the downloads section, and run the second sample down do you still get the error?


    I ran the second example and, yeah, it's still the same. It stops before uploading. Seems like the problem does come from the server, but what can it be? Some falsely set user rights? I still attached my folder structure so you can have look.

    Battlewizz
  • hmmm. It is looking like server settings. I copied your folder setup to my server and all ticked over without a problem.

    Let's have a look at
    1. what OS is your sever
    2. is your server local
    3. what are your php.ini settings - can you upload it so I can compare
    4. you said that if you remove the checkScript option it runs perfectly. But have the files actually uploaded?
  • TravisN. said:
    hmmm. It is looking like server settings. I copied your folder setup to my server and all ticked over without a problem.

    Let's have a look at
    1. what OS is your sever
    2. is your server local
    3. what are your php.ini settings - can you upload it so I can compare
    4. you said that if you remove the checkScript option it runs perfectly. But have the files actually uploaded?


    Hi, Sorry for the late answer.

    1. Linux (RedHat)
    2. No
    3. i attached my php.ini (now it should be attached, sorry)
    4. Yeah, the files uploaded perfectly

    Hope this helps...
  • Here's the main differences between my php.ini and yours
                       mine    yours
    max_input_time -1 60 -maximum time post and get scripts can send data (-1 = unlimited)
    memory_limit 124M 40M -should be greater than post_max_size

    and this, but I don't think this would have any effect. Worth a try though
    register_argc_argv On Off -Used for sending GET values across scripts

    There were others but nothing that relates to scripts. Try changing these values.
  • Also check to see if json is enabled. This isn't set in the php.ini. To check it create a new php file and put in phpinfo();
    when you run the page do a search for json. It needs to say enabled.
  • Chances are your server is running PHP 4 - the check.php script uses a
    json_encode
    function which is only included natively in PHP 5 - I had this problem as well. To solve this solution, you can either upgrade your PHP version or you can download a JSON.php file compatible with PHP 4 and include it in check.php before the encode call. Hope this helps.

    Matt
  • seminole75 said:
    Chances are your server is running PHP 4 - the check.php script uses a
    json_encode
    function which is only included natively in PHP 5 - I had this problem as well. To solve this solution, you can either upgrade your PHP version or you can download a JSON.php file compatible with PHP 4 and include it in check.php before the encode call. Hope this helps.

    Matt


    That's it, thanks a lot.

    I included the following code in the check.php:

    <?php
    if (!function_exists('json_encode'))
    {
    function json_encode($a=false)
    {
    if (is_null($a)) return 'null';
    if ($a === false) return 'false';
    if ($a === true) return 'true';
    if (is_scalar($a))
    {
    if (is_float($a))
    {
    // Always use \".\" for floats.
    return floatval(str_replace(\",\", \".\", strval($a)));
    }

    if (is_string($a))
    {
    static $jsonReplaces = array(array(\"\\\", \"/\", \"\n\", \"\t\", \"\r\", \"\b\", \"\f\", '\"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\\"'));
    return '\"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $a) . '\"';
    }
    else
    return $a;
    }
    $isList = true;
    for ($i = 0, reset($a); $i < count($a); $i++, next($a))
    {
    if (key($a) !== $i)
    {
    $isList = false;
    break;
    }
    }
    $result = array();
    if ($isList)
    {
    foreach ($a as $v) $result[] = json_encode($v);
    return '[' . join(',', $result) . ']';
    }
    else
    {
    foreach ($a as $k => $v) $result[] = json_encode($k).':'.json_encode($v);
    return '{' . join(',', $result) . '}';
    }
    }
    }
    ?>


    and now it works fine. The good thing is that the code is upwards compatible, so if i get upgraded to PHP 5.2 or higher, the native json functions will be used instead of the custom ones. Problem solved. :)
  • You would never feel unbearable heat and sweat inside, because the Air Jordans is designed to be the best wear for this season.The same as many other
    Air Jordan Shoes,the release of the Air Yeezy Shoes also arouse fierce arguments among sneaker fans.
  • Now,the name of christian louboutin 2012 is known to more and more people. There have a great number of people are interested in collecting cheap christian louboutin shoes them to change their dressing style and life louboutin 2012 style. As the modern lady,you need to wear sexy Christian Louboutin Pumps to be more charming and louboutin shoes discount sexy. Choose our online shop to buy the popular christian louboutin uk shoes is the most wise decision.
  • When ladies wearing a pair of louboutin shoes down the road,many people will attracted by them.As the modern lady,it is necessary for discounted christian louboutin you to get one or more to dress up yourself christian louboutin more fashionable and glamorous.This season,many kinds of new cheap christian louboutin shoes have designed by the famous footwear designer christian louboutin and published in the world.
  • When ladies wearing a pair of louboutin shoes down the road,many people will attracted by them.As the modern lady,it is necessary for discounted christian louboutin you to get one or more to dress up yourself christian louboutin more fashionable and glamorous.This season,many kinds of new cheap christian louboutin shoes have designed by the famous footwear designer christian louboutin and published in the world.
  • It is a fact that cheap louboutins as the popular collections are worth all ladies to purchase.Even though different people have own unique louboutins sale personality and temperament,but wear this brand louboutins shoes will let them full of fashion taste and noble louboutin shoes store temperament.I believe people who want to leave a deep impression on others,they need to buy christian louboutin on sale without any hesitation.
  • A pair of shining christian louboutin shoes is not only a sign of fashion taste,but also a symbol of social status and louboutins recognition.These louboutins pumps belong to christian louboutin sneakers would be designed in the unique way with signature red discount christian louboutin shoes soles. Choose the red soles christian louboutin discount shoes, just as choose your own beauty!
  • Please grasp every opportunity to get one or more basketball shoes 2012 to experience the real comfort and fashion.Whether you have owned this brand 2012 basketball shoes or not,it is necessary for you to own the latest kobe basketball shoes 2012. These shoes will bring you pleased mood.You will own enough confidence to face lebron basketball shoes 2012 everything.We are waiting for your visiting cheap basketball shoes and purchasing all the time.
  • [url=http://www.saleincoachoutlet.net/][b]Coach Outlet[/b][/url] are proud with Discount Coach Colette Bags sale.
  • Coach Outlet are proud with Discount Coach

    Colette Bags sale.
  • Coach Outlet are proud with Discount Coach

    Colette Bags sale. The Coach Outlet

    really is made well and definitely will last for many years. Colorful appearance
    href="http://www.saleincoachoutlet.net/">Coach Outlet Online
    and beauty accessories are

    the point of Coach Outlet Online. Every

    professional woman needs a good handbags. You can find the
    href="http://www.saleincoachoutlet.net/">Coach Outlet
    most suitable bags for you or

    your friends from our splendid Coach Purses

    Outlet
    all the time. It is well understood that
    href="http://www.coachoutletonlinepurse.org/">Cheap Coach Handbags
    has become a

    renowned gift all annual round bring offthe world. A modern morning
    href="http://www.coachsfactory-s.org/">Coach Factory
    stylish silhouette in

    sophisticated sateen ensemble visual element
    href="http://www.getcoachoutletonlines.org/">Coach Outlet Online
    with detachable

    shoulder strap, Coach Factory Outlet is

    specifically a luxurious ladylike choice!Every professional woman needs a good handbags.
  • Coach Outlet are proud with Discount Coach

    Colette Bags sale. The Coach Outlet

    really is made well and definitely will last for many years. Colorful appearance
    href="http://www.saleincoachoutlet.net/">Coach Outlet Online
    and beauty accessories are

    the point of Coach Outlet Online. Every

    professional woman needs a good handbags.
  • It is well understood that Cheap Coach Handbags has become a renowned gift all annual round bring offthe world. A modern morning Coach Factory stylish silhouette in sophisticated sateen ensemble visual elementCoach Outlet Online with detachable
    shoulder strap, Coach Factory Outlet is specifically a luxurious ladylike choice!Every professional woman needs a good handbags.
  • Coach Outlet are proud with Discount Coach Colette Bags sale. The Coach Outlet really is made well and definitely will last for many years. Colorful appearance Coach Outlet Online and beauty accessories are the point of Coach Outlet Online. Every professional woman needs a good handbags. You can find the Coach Outlet most suitable bags for you or your friends from our splendid Coach Purses Outlet all the time. It is well understood that Cheap Coach Handbags has become a renowned gift all annual round bring offthe world. A modern morning Coach Factory stylish silhouette in sophisticated sateen ensemble visual element Coach Outlet Online with detachable shoulder strap, Coach Factory Outlet is specifically a luxurious ladylike choice!Every professional woman needs a good handbags.
  • Coach Factory Outlet is a popular brand luxury handbags throughout the world. The discount Coach Outlet which are selling now is the Coach Luggage with stylish leather and signature materials. Coach Outlet are easy to match your clothes. What's more, carrying this bag that you will be the focus on the crowd. Go to our Coach Outlet to choose your favorite one. The handbags become a symbol of elegance and luxury. The design of Coach Outlet Online is very fashionable and innovative. And the price is fairly competitive. Coach enjoys a very high reputation in the world, so when you buy it, please don't worry. It featured with stylish Coach Scarf and signature materials. We all know that Coach Factory Outlet has a long history, it is not only famous for the Coach Handbags. They are easy to match your clothes.