2

I am using uploadify plugin to upload images. The main code is like:

<script type="text/javascript" src="/js/uploadify-v3.1/jquery-1.7.2.min.js"></script>
<link rel="stylesheet" type="text/css" href="/js/uploadify-v3.1/uploadify.css">
<script type="text/javascript" src="/js/uploadify-v3.1/jquery.uploadify-3.1.min.js"></script>
<script type="text/javascript">
$(function() {
    $('#file_upload').uploadify({
        'auto'     : false,
         'buttonCursor' : 'arrow',
        'checkExisting' : '/js/uploadify-v3.1/check-exists.php',
        'fileObjName' : 'the_files',
        'fileTypeExts' : '*.gif; *.jpg; *.png',
        'method'   : 'post',
        'queueID'  : 'some_file_queue',
        'swf'      : '/js/uploadify-v3.1/uploadify.swf',
        //'uploader' : '/js/uploadify-v3.1/uploadify.php',
        'uploader' : 'UploadifyController.php',
        'onUploadError' : function(file, errorCode, errorMsg, errorString) {
            alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
        } ,
    'onUploadSuccess' : function(file, data, response) {
        alert('The file was saved to: ' + data);
    } 

        // Your options here
    });
});
</script>

I have put these code in /views/scripts/.

How can I specify the uploadify.php as UploadifyController.php? or How can I use uploadify in zend?

Also I would like to know about how to specify the path 'upload' as target folder? Please help..

1 Answer 1

1

The uploader options is basically the path of the PHP that will process the upload. Obviously you cannot point to UploadifyController.php because the controller file itself does not execute anything in Zend. Assuming that there is an processAction function in that controller, you should use something like:

'uploader' : <?php echo $this->url(array('controller' => 'uploadify', 'action' => 'process'), default, true) ?>

Once in the action you can receive the file and save it anywhere using move_uploaded_file or relevant Zend framework methods.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.