Closed motin closed 10 years ago
First .... Well, this is probably the oldest part of my current Phundament code. The UploadHandler is not coded in a clean way and the entire component should be replaced with an up-to-date solution.
I removed the display of existing files, because of the problem, that you have to list too many files at a certain point. And therefore called it Upload Session.
I think the best way would be not to display the files, but fix all PHP and JavaScript errors also. I'd not put too much work into it, since this upload part has to be rewritten anyway.
I'll leave this ticket open.
For whatever reason, the output is from UploadHandler get() has been discarded in ImportController until recently: https://github.com/schmunk42/p3media/blob/develop/controllers/ImportController.php#L115
Now when it is not discarded, the upload form is now prepopulated with many existing file items even before I have selected any files to upload.
This is the code that causes the file list to show: https://github.com/schmunk42/p3extensions/blob/master/widgets/jquery-file-upload/UploadHandler.php#L78
Discarding the $contents can either lead to a 500 error when php error reporting is set to E_NOTICE.
If disgarded gracefully, another error crops up - TypeError: 'null' is not an object (evaluating 'files.length')
Happens in init.js because $('#fileupload form').prop('action') returns null. Possibly related to the fact that the get_list_objects() output is discarded.
What's the proper way of using UploadHandler in this context?