Topic: Cant make it run, all time I get error msg cant find Runtime...

Hi,

I'm trying make it work on asp.net,

all I tried and I'm still getting Message which Cant find Runtime.

I'm using last Plupload version.

I did this:

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">

<head>


<script type="text/javascript" src="http://www.google.com/jsapi"></script>

<script type="text/javascript">
    google.load("jquery", "1.3");

</script>

<script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>

<!-- Load source versions of the plupload script files -->

<script type="text/javascript" src="../plupload/js/plupload.js"></script>

<script type="text/javascript" src="../plupload/js/plupload.gears.js"></script>

<script type="text/javascript" src="../plupload/js/plupload.silverlight.js"></script>

<script type="text/javascript" src="../plupload/js/plupload.flash.js"></script>

<script type="text/javascript" src="../plupload/js/plupload.browserplus.js"></script>

<script type="text/javascript" src="../splupload/js/plupload.html5.js"></script>

<script type="text/javascript" src="../plupload/js/jquery.plupload.queue/jquery.plupload.queue.js"></script>

<script>
    // Custom example logic
    $(function () {
        var uploader = new plupload.Uploader({
            runtimes: 'flash,silverlight,browserplus,html5',
            browse_button: 'pickfiles',
            max_file_size: '10mb',
            url: 'upload.php',
            resize: { width: 320, height: 240, quality: 90 },
            flash_swf_url: '../plupload/js/plupload.flash.swf',
            silverlight_xap_url: '../plupload/js/plupload.silverlight.xap',
            filters: [
            { title: "Image files", extensions: "jpg,gif,png" },
            { title: "Zip files", extensions: "zip" }
        ]
        });

        uploader.bind('Init', function (up, params) {
            $('#filelist').html("<div>Current runtime: " + params.runtime + "</div>");
        });

        uploader.bind('FilesAdded', function (up, files) {
            $.each(files, function (i, file) {
                $('#filelist').append(
                '<div id="' + file.id + '">' +
                file.name + ' (' + plupload.formatSize(file.size) + ') <b></b>' +
            '</div>');
            });
        });

        uploader.bind('UploadFile', function (up, file) {
            $('<input type="hidden" name="file-' + file.id + '" value="' + file.name + '" />')
            .appendTo('#submit-form');
        });

        uploader.bind('UploadProgress', function (up, file) {
            $('#' + file.id + " b").html(file.percent + "%");
        });

        $('#uploadfiles').click(function (e) {
            uploader.start();
            e.preventDefault();
        });

        uploader.init();

        var uploader_new = new plupload.Uploader({
            runtimes: 'gears,html5,flash,silverlight,browserplus',
            browse_button: 'pickfiles_new',
            max_file_size: '10mb',
            url: 'upload.php',
            resize: { width: 320, height: 240, quality: 90 },
            flash_swf_url: '../plupload/js/plupload.flash.swf',
            silverlight_xap_url: '../plupload/js/plupload.silverlight.xap',
            filters: [
            { title: "Image files", extensions: "jpg,gif,png" },
            { title: "Zip files", extensions: "zip" }
        ]
        });

        uploader_new.bind('Init', function (up, params) {
            $('#filelist_new').html("<div>Current runtime: " + params.runtime + "</div>");
        });

        uploader_new.bind('FilesAdded', function (up, files) {
            $.each(files, function (i, file) {
                $('#filelist_new').append(
                '<div id="' + file.id + '">' +
                file.name + ' (' + plupload.formatSize(file.size) + ') <b></b>' +
            '</div>');
            });
        });

        uploader_new.bind('UploadFile', function (up, file) {
            $('<input type="hidden" name="file-' + file.id + '" value="' + file.name + '" />')
            .appendTo('#submit-form');
        });

        uploader_new.bind('UploadProgress', function (up, file) {
            $('#' + file.id + " b").html(file.percent + "%");
        });

        $('#uploadfiles_new').click(function (e) {
            uploader_new.start();
            e.preventDefault();
        });

        uploader_new.init();
    });

What I'm missing here?

Re: Cant make it run, all time I get error msg cant find Runtime...

First you better call uploader.init() before you bind event handlers, unless you know what you are doing.

Have you checked script paths? Are they alright?

If you want to see your issue fixed, do not report it here, do it on - GitHub.

Re: Cant make it run, all time I get error msg cant find Runtime...

I'm using this Upload handler:

<%@ WebHandler Language="C#" Class="Upload" %>

using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Net;
using System.Web;


public class Upload : IHttpHandler
{
    public void ProcessRequest(HttpContext context)
    {
        int chunk = context.Request["chunk"] != null ? int.Parse(context.Request["chunk"]) : 0;
        string fileName = context.Request["name"] != null ? context.Request["name"] : string.Empty;

        HttpPostedFile fileUpload = context.Request.Files[0];

        var uploadPath = context.Server.MapPath("~/TicketUploads");
        using (var fs = new FileStream(Path.Combine(uploadPath, fileName), chunk == 0 ? FileMode.Create : FileMode.Append))
        {
            var buffer = new byte[fileUpload.InputStream.Length];
            fileUpload.InputStream.Read(buffer, 0, buffer.Length);

            fs.Write(buffer, 0, buffer.Length);
        }

        context.Response.ContentType = "text/plain";
        context.Response.Write("Success");
    }

    public bool IsReusable
    {
        get { return false; }
    }
}

And this page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <!-- Thirdparty intialization scripts, needed for the Google Gears and BrowserPlus runtimes -->
<script type="text/javascript" src="/plupload/js/plupload.gears.js"></script>
<script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>

<!-- Load plupload and all it's runtimes -->
<script type="text/javascript" src="/plupload/js/plupload.full.js"></script>

<script type="text/javascript">
    // Custom example logic
    $(function () {
        var uploader = new plupload.Uploader({
            runtimes: 'gears,html5,flash,silverlight,browserplus',
            browse_button: 'pickfiles',
            container: 'container',
            max_file_size: '10mb',
            url: 'Upload.ashx',
            flash_swf_url: '/plupload/js/plupload.flash.swf',
            silverlight_xap_url: '/plupload/js/plupload.silverlight.xap',
            filters: [
            { title: "Image files", extensions: "jpg,gif,png" },
            { title: "Zip files", extensions: "zip" }
        ],
            resize: { width: 320, height: 240, quality: 90 }
        });
       
        uploader.bind('Init', function (up, params) {
            $('#filelist').html("<div>Current runtime: " + params.runtime + "</div>");
        });

        $('#uploadfiles').click(function (e) {
            uploader.start();
            e.preventDefault();
        });

       

        uploader.bind('FilesAdded', function (up, files) {
            $.each(files, function (i, file) {
                $('#filelist').append(
                '<div id="' + file.id + '">' +
                file.name + ' (' + plupload.formatSize(file.size) + ') <b></b>' +
            '</div>');
            });

            up.refresh(); // Reposition Flash/Silverlight
        });

        uploader.bind('UploadProgress', function (up, file) {
            $('#' + file.id + " b").html(file.percent + "%");
        });

        uploader.bind('Error', function (up, err) {
            $('#filelist').append("<div>Error: " + err.code +
            ", Message: " + err.message +
            (err.file ? ", File: " + err.file.name : "") +
            "</div>"
        );

            up.refresh(); // Reposition Flash/Silverlight
        });

        uploader.bind('FileUploaded', function (up, file) {
            $('#' + file.id + " b").html("100%");
        });
    });
</script>
</head>




<body>
    <form id="form1" runat="server">
    <div>
   
<h3>Custom example</h3>
<div id="container">
    <div id="filelist">No runtime found.</div>
    <br />
    <a id="pickfiles" href="#">[Select files]</a>
    <a id="uploadfiles" href="#">[Upload files]</a>
</div>
   
    </div>
    </form>
</body>
</html>       

Still nothing happened getting: No runtime found.

Re: Cant make it run, all time I get error msg cant find Runtime...

I haven't reviewed your code in details but ast @davit mentioned you must call the init function after you bind the Init event, but before you bind any of the other event handlers.  See below:


....
        uploader.bind('Init', function (up, params) {
            $('#filelist').html("<div>Current runtime: " + params.runtime + "</div>");
        });

        uploader.init   // ** Call init here.

        $('#uploadfiles').click(function (e) {
            uploader.start();
            e.preventDefault();
        });
....

Re: Cant make it run, all time I get error msg cant find Runtime...

Did,

Still no runtime is running...

Re: Cant make it run, all time I get error msg cant find Runtime...

You need to provide more details if someone is to help you.  What happens when you load your web-site in a browser?  Are there any messages in the console? etc.

Re: Cant make it run, all time I get error msg cant find Runtime...

I wrote all this in aspx code
what should I write in
    <form> tag,
I think that's my problem.
cause in the php example in form tag there is a method="post" action="dump.php">

What to change it for?
thanks...

Re: Cant make it run, all time I get error msg cant find Runtime...

@b007, dump.php is not related to your problem. The only reason for "no runtime" error is that no runtime can be loaded, either because your browser doesn't support any (I doubt it can't do html5 or flash, but you can add html4 in the end of runtimes list just to eliminate this case - html4 will be loaded in any case) or scripts are simply not loaded at all.

Have you rechecked script paths? Are you able to load them in your browser by pasting their urls into the address bar?

If you want to see your issue fixed, do not report it here, do it on - GitHub.

Re: Cant make it run, all time I get error msg cant find Runtime...

I've found that an unmatched ( or { will cause it to say no runtime is available. Double check all of those.