sasori Posted September 8, 2013 Share Posted September 8, 2013 (edited) 2 Problems Hi, 1 ) has anyone ever used the plupload ?, my problem right now is, when i triy uploading .gif files with big dimensions, it doesn't get through. but with jpeg,jpg it does work here's the current configuration of my plupload 'options' => array( 'runtimes' => 'gears,html5,flash,silverlight,browserplus', 'url' => $this->createUrl('upload'), "max_file_size" => '10mb', 'chunk_size' => '1mb', 'unique_names' => true, 'resize' => array('width' => 900, 'height' => 900, 'quality' => 90), 'filters' => array( array("title" => "Image files", "extensions" => "jpg,gif,png,jpeg") ), 2) how to throw an error to the user that the upload has failed ? , like e.g while uploading the internet connection has failed. and I wanna tell them that they need to re-upload the file? I added this in the array 'Error' => 'js:function(up,file){ alert("File was not uploaded properly"); }', Edited September 8, 2013 by sasori Quote Link to comment https://forums.phpfreaks.com/topic/281976-pl-upload-unable-to-accept-big-dimension-gif-file/ Share on other sites More sharing options...
jazzman1 Posted September 9, 2013 Share Posted September 9, 2013 Hey sasori, just create a custom function and bind the plupload "FileUploaded" method to it. Check if all files are successfully uploaded on the server and the status of this connection is equal to 200.Then pass this custom function to preinit.So, it would like something like: // added redirect function after uploading was successfully function attachCallbacks(uploader) { uploader.bind('FileUploaded', function(Up, File, Response) { // count total of uploaded files var u_count = uploader.total.uploaded; // get the length of uploaded files var f_length = uploader.files.length; // check the status and status of failed uploaded files if(!uploader.total.failed && Response.status == 200) { // redirect the page after successfully uploading images if((u_count+1) == f_length) window.location.assign('http://www......'); } else { alert('Failed uploading'); return false; } }) } All script: <script type="text/javascript"> // Convert divs to queue widgets when the DOM is ready $(function() { $("#uploader").pluploadQueue({ // General settings runtimes : 'gears,html5,flash', url : 'index.php?action=upload', max_file_size : '1mb', chunk_size : '1mb', unique_names : false, // redirect mod preinit : attachCallbacks, // Specify what files to browse for filters : [ {title : "Allowed files", extensions : "jpg,gif,png,txt,doc,docx,pdf,zip"} ], // Flash settings flash_swf_url : 'js/plupload.flash.swf' }); // Client side form validation $('form').submit(function(e) { var uploader = $('#uploader').pluploadQueue(); // Files in queue upload them first if (uploader.files.length > 0) { // When all files are uploaded submit form uploader.bind('StateChanged', function() { if (uploader.files.length === (uploader.total.uploaded + uploader.total.failed)) { $('form')[0].submit(); } }); uploader.start(); } else { alert('You must queue at least one file.'); } return false; }); }); // added redirect function after uploaded function attachCallbacks(uploader) { uploader.bind('FileUploaded', function(Up, File, Response) { // count total of uploaded files var u_count = uploader.total.uploaded; // get the length of uploaded files var f_length = uploader.files.length; // check the status and status of failed uploaded files if(!uploader.total.failed && Response.status == 200) { // redirect the page after successfully uploading images if((u_count+1) == f_length) window.location.assign('index.php'); } else { alert('Failed uploading'); return false; } }) } </script> Quote Link to comment https://forums.phpfreaks.com/topic/281976-pl-upload-unable-to-accept-big-dimension-gif-file/#findComment-1448782 Share on other sites More sharing options...
sasori Posted September 10, 2013 Author Share Posted September 10, 2013 with regards to the issue, there's another thing, even if the response is "200" , if you check in firebug...you will see that there's "pink" colored bar in the timeline., does that mean incomplete upload? ..because the typical color of the "200" ok response is blue in firebug , right? Quote Link to comment https://forums.phpfreaks.com/topic/281976-pl-upload-unable-to-accept-big-dimension-gif-file/#findComment-1448962 Share on other sites More sharing options...
jazzman1 Posted September 10, 2013 Share Posted September 10, 2013 Red color link with status 200 OK, it sounds for me, that there is a security warning/error. What type of data are you expecting to be received from the server? Quote Link to comment https://forums.phpfreaks.com/topic/281976-pl-upload-unable-to-accept-big-dimension-gif-file/#findComment-1448991 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.