Topic: How to specify the upload.php file?

In the example code I am currently running the url parameter is set to "upload.php". I want to change this so that it uses my own upload.php file for processing the file uploads.

However I have noticed a very strange thing. No matter what I put as the url parameter it makes no difference to how the uploading process appears to go.

E.g.

With the default "upload.php" file specified the files appear to upload to somewhere, although I can't find where.

If I replace "upload.php" with "thisfiledoesnotexist.php" the upload appears to take place anyway and there are no error messages of any kind.

If I replace "upload.php" with "myupload.php" (a real file) the files still appear to upload even though myupload.php just has a die() statement.

I think I must be doing something wrong here :)

All help gratefully received.

Re: How to specify the upload.php file?

It would be easier to answer if you gave a little more context and posted some code.

Where are you changing the reference to upload.php in your code?  Are you working with one of the examples or putting plupload into your own site?  And are you using the JQuery widget or working with the lower level API?

Re: How to specify the upload.php file?

My code looks like this:

<!-- Load Queue widget CSS and jQuery -->
<style type="text/css">
@import url(/css/plupload.queue.css);
</style>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
    google.load("jquery", "1.3");
</script>

<!-- Thirdparty intialization scripts, needed for the Google Gears and BrowserPlus runtimes -->
<script type="text/javascript" src="/plupload/js/gears_init.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 and finally the jQuery queue widget -->
<script type="text/javascript" src="/plupload/js/plupload.full.min.js"></script>
<script type="text/javascript" src="/plupload/js/jquery.plupload.queue.min.js"></script>

<script type="text/javascript">
// Convert divs to queue widgets when the DOM is ready
$(function() {
    $("#uploader").pluploadQueue({
        // General settings
        runtimes : 'html5,gears,flash,silverlight,browserplus',    // The first one of these that is available is the one that is used. HTML5 allows drag/drop
        url : 'http://www.vavavid.com/xxfileupload.php',    // The php file that processes the file uploads
        max_file_size : '100mb',
        chunk_size : '1mb',
        unique_names : 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,mov,mp4,3gp,avi"},
            {title : "Zip files", extensions : "zip"}
        ],

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

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

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

        // 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();
        }
    });
});
</script>
<form ..>
    <div id="uploader">
        <p>You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.</p>
    </div>
</form>
           

I am using "url : 'http://www.vavavid.com/xxfileupload.php'" to specify the php file to handle the uploaded files. It seems that whatever I give for the url the Plupload code works exactly the same, appearing to upload the files.

I am sure I must be making a rookie error!

Re: How to specify the upload.php file?

Queue widget doesn't report back when you are specifying wrong upload url neutral Although you could handle custom behavior for such case yourself, if you bind onto Error event.

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

Re: How to specify the upload.php file?

That explains the behaviour I have been getting. Thanks. It does seem odd though that Plupload will look to the user as if the files are being uploaded even though they are not!

Re: How to specify the upload.php file?

Is there an example anywhere of how to bind to the error event?

Re: How to specify the upload.php file?

Yes. Check this one here for example. It demonstrates how to bind an Error event handler among others.

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

Re: How to specify the upload.php file?

Hi,

Thanks for this. I checked in a few other places and this one actually seems to deliver with precise information related to my problem also. A great help with you Guys. Thanks:)

9 (edited by dale5alfred 2011-03-11 08:54:51)

Re: How to specify the upload.php file?

What is the maximum or standard size considered that can be easily uploaded?

Re: How to specify the upload.php file?

@dale5alfred it varies actually, but probably any runtime can upload files up to 1gb just fine. For bigger files I'd suggest using SilverLight, as it doesn't not read complete file into the memory before starting upload, but streams it out right from disk. We also have a Java runtime on schedule for really big files, but it probably won't see the light until we do a major update of the code.

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