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

Allow Cross-Origin requests in webservice/upload.php

    XMLWordPrintable

Details

    • MOODLE_33_STABLE
    • MOODLE_34_STABLE
    • MDL-60302-master
    • Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Create a Token in the mobile app service for one user:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      3. Unzip the attached zip file
      4. Edit the unzipped js/script.js file, look for the line starting by oXHR.open('POST', and change the Moodle URL with your one, replace the token with the token generated in step 2
      5. Open the unzipped index.html in a browser
      6. Upload a file via the index.html form and check that you receive a response similar to the attached expected-response.png (it may change some values like the itemid, filename, contextid, userid)
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for one user: Click on Site administration ► Plugins ► Web services ► Manage tokens Unzip the attached zip file Edit the unzipped js/script.js file, look for the line starting by oXHR.open('POST', and change the Moodle URL with your one, replace the token with the token generated in step 2 Open the unzipped index.html in a browser Upload a file via the index.html form and check that you receive a response similar to the attached expected-response.png (it may change some values like the itemid, filename, contextid, userid)

    Description

      It would be good to ad a 'Access-Control-Allow-Origin: *' header in upload.php to allow cross origin requests.

      If allowed you could upload files over webservice/upload.php from chrome or firefox.

      Attachments

        Issue Links

          Activity

            People

              jleyva Juan Leyva
              nico0302 Nico0302
              Dani Palou Dani Palou
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                13/Nov/17