PDA

View Full Version : Extjs 5 - Fileupload submit error



vitorpfn
25 Feb 2015, 5:16 AM
I have a fileupload and a spring controller to receive the images from the form submit. My spring controller is working, i see the request and the success response but my form callback give me this error.

responseText:"{success:false,message:"Blocked a frame with origin "http://localhost"from accessing a cross-origin frame."}"In the browser request, i see the correct response but i dont see this response. What is can do to solve my problem?

Gary Schlosberg
25 Feb 2015, 6:39 AM
Thanks for the report. I couldn't find any existing reports of this. Can you please post a test case which reproduces this issue?
https://fiddle.sencha.com/#home

vitorpfn
25 Feb 2015, 7:07 AM
When i use a filefield, an hidden iframe is generated to receive the server response? Maybe this is my problem

Gary Schlosberg
25 Feb 2015, 4:00 PM
Could be. This behavior is described in the docs:
http://docs.sencha.com/extjs/5.1/5.1.0-apidocs/#!/api/Ext.form.Basic
http://docs.sencha.com/extjs/5.1/5.1.0-apidocs/#!/api/Ext.form.Basic-method-hasUpload

rafaelreuber
4 May 2015, 3:56 PM
I'm facing the problem even the server returning a Content-Type header with "text/html" value.

Gary Schlosberg
5 May 2015, 3:36 PM
What about if you try a Content-Type of 'text-plain'?

rafaelreuber
5 May 2015, 3:47 PM
Same problem with Conten-Type set to text/plain.

52336

Gary Schlosberg
6 May 2015, 3:05 PM
Are you trying to submit the form to a different domain or IP than the one hosting it?

rafaelreuber
6 May 2015, 5:27 PM
Yes it is from another domain.It seems to be a CORS issue.

Gary Schlosberg
7 May 2015, 3:58 PM
Yes. Here's a link that might help with that:
http://enable-cors.org/

http://docs.sencha.com/extjs/5.1/5.1.0-apidocs/#!/api/Ext.data.Connection-cfg-cors (http://enable-cors.org/)

wemerson.januario
8 Sep 2016, 5:57 AM
I have this same problem with Ext JS 6. I need to upload file to a Restful API. How to fix this? Thanks

Gary Schlosberg
8 Sep 2016, 1:35 PM
Are you submitting the file to a different domain than the one on which the form is hosted?

wemerson.januario
8 Sep 2016, 4:15 PM
Yes, I am! I have an Ext JS front app, and an external restful api in other domain


Are you submitting the file to a different domain than the one on which the form is hosted?

wemerson.januario
12 Sep 2016, 6:27 PM
What is the solution/best practice to upload files using a RESTful API to a different domain?

jaxset
21 Dec 2016, 6:58 AM
Any solution for this? I need to call a REST-API on another domain for file uploading. After days of search I still don't have a solution.

If it does matter: i use ExtJS6

Gary Schlosberg
21 Dec 2016, 10:56 AM
I'm afraid for now the solution here is to use the same domain for file uploads.

jaxset
22 Dec 2016, 1:56 AM
Okay. What I need:
- upload file (prefer cross domain)
- custom headers

2 Possible solutions:

1) submit():
- no cross domain (i can live with that)
- no custom headers

2) Ajax.request():
- cross domain possible
- custom header
- no file upload

So both solutions are not perfect. Regarding to the Ajax file upload I saw that it should be possible with XHR2.
https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects

So it is just a limitation of ExtJS? It is really confusing.

Gary Schlosberg
22 Dec 2016, 9:15 AM
There is a feature request (EXTJS-12483) to add XHR2 to the framework, but it has yet to be implemented.