Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-66218

core_files_upload API is designed so that it cannot be used for anything except extremely small files

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.6.5, 3.7, 3.7.1
    • Fix Version/s: None
    • Component/s: Web Services
    • Affected Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE

      Description

      core_files_upload requires a file be encoded and placed in the URL. Most hosting services limit the length/size of URL's. Using this API with (for example) Moodles own cloud hosting service for an image upload requires the image to be scaled down to about 100x100 pixels (and JPG encoded at the maximum loss level in my image app) to get it down to about 5.4kb. (Anything larger generates an error page by models own cloud hosting service, see below). This is not just a problem with Moodle's hosting service, but others as well (i.e. googles Cloud service limits the full HTTP header to 16kb.

      There should be a way to upload user profile pictures (for any account) that is not restricted by this limitation. I am flagging this as major, as this API is essentially broken for any use case I can think of. (Even word documents average at more than 5k these days)

      I am aware there is an alternate way to upload files, using /webservice/upload.php, but as far as I can tell from the comments in the code, it is not possible for an admin to upload the profile picture for an individual user. (see source)

      Recommend that the upload.php code be updated to allow uploading on behalf of any user. Or perhaps, even an alternate script to allow an admin to upload user profile pictures. It seems to be a common enough use case to warrant that.

       See: MDL-22236  , MDL-56070

      <!DOCTYPE HTML PUBLIC "//IETF//DTD HTML 2.0//EN"><html><head><title>414 Request-URI Too Long</title></head><body><h1>Request-URI Too Long</h1><p>The requested URL's length exceeds the capacitylimit for this server.<br /></p><hr><address>Apache Server at template.moodlecloud.com Port 80</address></body></html>Server returned unexpected response: <!DOCTYPE HTML PUBLIC "//IETF//DTD HTML 2.0//EN"><html><head><title>414 Request-URI Too Long</title></head><body><h1>Request-URI Too Long</h1><p>The requested URL's length exceeds the capacitylimit for this server.<br /></p><hr><address>Apache Server at template.moodlecloud.com Port 80</address></body></html>

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            Zadok Zadok Kin
            Participants:
            Component watchers:
            Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: