1
votes

I'm trying to use Element-UI's component to upload files to Firebase's Google Cloud storage. Apparently the 'action' handler won't accept the 'gs://' prefix standard to Firebase uploads. When I try it, I get this error:

XMLHttpRequest cannot load gs://.../x/y. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

Is there a way around this, or will I have to use another upload method?

1

1 Answers

1
votes

Try passing an empty string to action and putting your custom function in http-request like this:

       <el-upload
            class="upload-demo"
            drag
            action=""
            :http-request="yourCustomFunction"
            :on-preview="handlePreview"
            :on-remove="handleRemove"
            :file-list="fileList"
            multiple>

http-request overrides default xhr behavior: http://element.eleme.io/#/en-US/component/upload