How to debug a download?

I do not know how to debug Uploadify. Everything seems to work, but there is no file uploaded. From the browser ... The page event prints "Done!". Before I used Uploadify, the PHP code worked ... so I don't know where the problem is.

<input id="file_upload" name="file_upload" type="file" rel="<?php echo $group_id; ?>" /> 

(without <form> )

In Javascript ...

 $('#file_upload').uploadify({ 'uploader' : '/media/js/uploadify/uploadify.swf', 'script' : '/bio/community/group_picture/' + $('#file_upload').attr('rel'), 'cancelImg' : '/media/img/bio/_blog_delete.png', 'buttonImg' : '/media/img/bio/browse_files.png', 'wmode' : 'transparent', 'auto' : true, 'width' : 92, 'sizeLimit' : 31457280, 'height' : 26, 'scriptData' : {'session' : session_id}, 'onAllComplete' : function() { location.reload(); } }); 

In PHP:

Controller:

 public function action_group_picture($group_id) { $model_group = Model::factory('Bio_Community_Group'); if (!empty($_FILES)) { $model_group->add_picture($_FILES['file_upload'], $group_id); $this->request->redirect('bio/community/edit_group/' . $group_id); } exit; } 

Model:

 public function add_picture($image, $group_id) { $filename = $group_id . '.jpg'; $location = 'uploads/bio/community/groups/' . $filename; $image = Image::factory($image['tmp_name']); if ($image->width !== 60 || $image->height !== 60) { $image->crop(60, 60); } $image->save($location); } 

I use Kohana, by the way. Any ideas why this doesn't work or how to debug it?

+4
source share
3 answers
  • Use Firebug (FireFox plugin) to get request information (headers, HTTP response, etc.).
  • Add input to the controller (for example, request save points).
  • Check the httpd logs.
+2
source

Try using debug:true .

It shows a script log window:

 $(function() { $("#file_upload").uploadify({ 'debug' : true, 'swf' : '/uploadify/uploadify.swf', 'uploader' : '/uploadify/uploadify.php' }); }); 
+7
source

I am writing all js events to the console. There are many of them: onSelect, onOpen, onProgress, onComplete, etc. This may give you a little more information about what happens at boot time.

For instance:

 onComplete : function ( event, ID ... console.log( event ); console.log( ID ); .... 

etc. etc.

See here: http://www.uploadify.com/documentation/

In general, though, seeing inside is a pain. My charles for some reason does not infect server traffic.

EDIT: also, one more thing that I usually forget when I'm deep in JS and things don't return correctly. Is my server side error free? Uploadify does not return the text of any HTTP status codes that you send in your response, so even if you give 503 or something else, you will not get your own error text. I am trying to create a dummy form for submitting only in html format, so I can make sure that the server side code is correct.

(side note: Uploadify also for some reason does not recognize the http 400 status code as an error, even if it is specified in the specification: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1 )

+2
source

All Articles