chamilo / chamilo-lms

Chamilo is a learning management system focused on ease of use and accessibility
https://chamilo.org
GNU General Public License v3.0
798 stars 480 forks source link

[C2] Enable web service to upload documents with options #4735

Open ywarnier opened 1 year ago

ywarnier commented 1 year ago

In Chamilo 1.11, when uploading a file, you have an option to choose a "Simple" form rather than a drag&drop area. This option gives you additional settings to choose from: upload-options

The Title and Comment fields are not really important (users can change them afterwards) but the "Uncompress zip" and the "If file exists" options must still be present in C2.

In C1, we used to call document.ajax.php with action = upload_file for the drag&drop, but the "simple" form would just call main/document/upload.php again (with recent changes including bigUpload.js).

In C2, we don't have that bigUpload stuff yet (because of the way we have split C1 and C2 2 years ago), and there is no mechanism to pass those "if_exists" and "unzip" options.

Please add those options to the current documents API, so that front-end devs can extend the current upload feature to include these options.

christianbeeznest commented 1 year ago

It is added api controller and implemented in back-end in this PR https://github.com/chamilo/chamilo-lms/pull/4774

Thanks for confirmation.

NicoDucou commented 1 year ago

Hi @christianbeeznest

The option "Rename the uploaded file if it exists" is working fine. But the 2 others "Overwrite the existing file" and "Do nothing" gives an error "Upload failed"

The "Uncompress zip" do not work either. It import the file as it is without unzipping it.

I tried it from here https://testing24.beeznest.com/resources/document/4/upload?cid=1&sid=0&gid=0

Best regards

christianbeeznest commented 1 year ago

Hi @NicoDucou ,

It seems that portal is not updated with that PR , you can see the changes are not visible yet https://github.com/chamilo/chamilo-lms/pull/4774/files#diff-c5fcacf3c8a72cdde5e45bbeccfb085d5100a46b83d020cfac840aab977cd7df

Thanks for confirmation.

NicoDucou commented 1 year ago

Hi @christianbeeznest It's just that in the 5 days since I tested it with your branch I had to do some other testing on other branches. But I just checked out your branch again and it is not working. I'll try to leave your branch, but if this is not the case just do a new checkout of your branch to check. Best regards

christianbeeznest commented 1 year ago

Hi @NicoDucou

I just commited a fix about it. it is working locally, I'm trying to check in testing24 but cleaning the cache the portal keeps loading until getting this error PHP Fatal error: Allowed memory size . Could you confirm it please ?