Richard Knop
Richard Knop

Reputation: 83705

Zend Framework + Uplodify Flash Uploader Troubles

I've been trying to get the Uploadify flash uploader (www.uploadify.com) to work with Zend Framework, with no success so far.

I have placed all Uploadify files under /public/flash-uploader directory.

In the controller I include all required files and libraries like this:

$this->view->headScript()->appendFile('/js/jquery-1.3.2.min.js');
$this->view->headLink()->appendStylesheet('/flash-uploader/css/default.css');
$this->view->headLink()->appendStylesheet('/flash-uploader/css/uploadify.css');
$this->view->headScript()->appendFile('/flash-uploader/scripts/swfobject.js');
$this->view->headScript()->appendFile('/flash-uploader/scripts/jquery.uploadify.v2.1.0.min.js');

And then I activate the plugin like this (#photo is id of the input file field):

$(document).ready(function() {
    $("#photo").uploadify({
    'uploader'       : '/flash-uploader/scripts/uploadify.swf',
    'script'         : 'my-account/flash-upload',
    'cancelImg'      : '/flash-uploader/cancel.png',
    'folder'         : 'uploads/tmp',
    'queueID'        : 'fileQueue',
    'auto'           : true,
    'multi'          : true,
        'sizeLimit'      : 2097152
    });
});

As you can see I am targeting the my-account/flash-upload script as a backend processing (my-account is a controller, flash-upload is an action).

My form markup looks like this:

<form enctype="multipart/form-data" method="post" action="/my-account/upload-public-photo"><ol>
<li><label for="photo" class="optional">File Queue<div id="fileQueue"></div></label>
<input type="hidden" name="MAX_FILE_SIZE" value="31457280" id="MAX_FILE_SIZE" />
<input type="file" name="photo" id="photo" class="input-file" /></li>
<li><div class="button">
<input type="submit" name="upload_public_photo" id="upload_public_photo" value="Save" class="input-submit" /></div></li></ol></form>

And yet it's not working. The browse button doesn't even show up as in the demo page, I get only a regular input file field.

Any ideas where could the problem be? I've already been staring into the code for hours and I cannot see any mistake anywhere and I'm starting to be exhausted after going through the same 30 lines of code 30 times in a row.

Upvotes: 2

Views: 2082

Answers (1)

Rodolphe
Rodolphe

Reputation: 497

By looking through the demo code and the documentation : it seems that the plugin is providing the 'FORM' elements by itself.

You should try to put your input field outside your form

Never used this tool before, just my 2 cents :)

Upvotes: 1

Related Questions