Hello,
I'll re-edit this to tackle the uploadify issue.
Its very strange, essentially the script isn't uploading and isn't triggering onAllComplete.
Also if I try to upload an image that's to large, and click Upload files, it skips from 0 to 100%. But does not trigger onAllComplete. It does not upload either.
Whats strange, is I have an earlier revision of this and the codes no different and it works, ive tried switched back to the same jquery/uploadify/layout and it still doesnt work.
However due to the nature of uploadify not being very forthcoming about errors or whats going on, I can't figure out where its going wrong!
Controller:
public function manageImagesAction() {
$id = $this->_getParam('id');
$object = Eurocreme_Gallery::load_by_fields(array('id' => $id), 1);
$images = Eurocreme_Image::load_by_type(array('type' => 'gallery_id', 'values' => $id, 'from' => 0, 'to' => COUNT_HIGH, 'order' => 'gi.position ASC'));
$this->view->object = $object;
$this->view->images = $images;
$this->view->headScript()->appendFile('/library/jquery/uploadify/swfobject.js');
$this->view->headScript()->appendFile('/library/jquery/uploadify/jquery.uploadify.v2.1.0.js');
$this->view->headScript()->appendFile('/library/jquery/ui.js');
}
View:
<div class="content-area">
<h1>Adding Images To "<?php echo $this->object->name; ?>" Gallery</h1>
<p><input id="fileInput2" name="fileInput2" type="file" /></p>
<p><a href="javascript:$('#fileInput2').uploadifyUpload();">Upload Files</a> | <a href="javascript:$('#fileInput2').uploadifyClearQueue();">Clear Queue</a></p>
</div>
<?php if (!empty($this->images)) { ?>
<div class="content-area">
<h1>Order Images For <?php echo $this->object->name; ?></h1>
<p id="status_update">Drop And Drag Images to re-order them, I will automatically save it for you!</p>
<ul id="sort_list">
<?php foreach ($this->images as $image) { ?>
<li class="removable" id="recordsArray_<?php echo $image->id; ?>"><img src="/images/Image/thumb/<?php echo $image->image_url; ?>" alt="<?php echo $image->name_url; ?>" title="<?php echo $image->name; ?>" /><p><a class="removable" id="<?php echo $image->id; ?>">Delete</a></p></li>
<?php } ?>
</ul>
<p class="clear"></p>
</div>
<?php } ?>
<?php $this->headScript()->captureStart(); ?>
$('document').ready(function() {
$("#fileInput2").uploadify({
'uploader' : '/library/jquery/uploadify/uploadify.swf',
'script' : '/<?php echo $this->object->name_url; ?>/upload.php',
'cancelImg' : '/library/jquery/uploadify/cancel.png',
'folder' : '/images/Image/',
'multi' : true,
'onAllComplete' : function(e, queueId, file, response, data) {
window.location.reload();
},
})
//sortable
$(function() {
$("#sort_list").sortable({ opacity: 0.6, cursor: 'move', update: function() {
$("#status_update").html('Processing');
var order = $(this).sortable("serialize");
$.post("/administration/gallery/save-image-order/id/<?php echo $this->object->id; ?>", order, function(theResponse){
$("#status_update").html(theResponse);
});
}
});
//delete
$('a.removable').click(function(){
var id = this.id;
$.post("/administration/gallery/delete-image/gallery_id/<?php echo $this->object->id; ?>/image_id/"+id+"", '', function(theResponse) {
$("#recordsArray_"+id+"").remove();
});
});
});
});
<?php $this->headScript()->captureEnd(); ?>