XML not well formed
Mac OSx v10.12.6 Firefox 54.0.1
On Firefox I'm getting the following error after the:
const xhr = new XMLHttpRequest();
xhr.open('GET',
XML Parsing Error: not well-formed Location:
I changed this to an AJAX 'GET' and set dataType and mimeType to 'application/pdf/' but then get:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://S3BUCKET.s3-ap-southeast-2.amazonaws.com/596772d37d3e5f6170d51de9/599be64abbebb505d93f0327/Annexure-1.pdf?AWSAccessKeyId=AWSACCESSKEY&Content-Type=application%2Fpdf&Expires=1503390725&Signature=SIGNATUREU%3D&x-amz-acl=public-read. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
Hi @ChrisGrigg,
I just tested this on Firefox 54.0.1 on MacOS, and the upload was successful.
However, the console does report a warning (though not an error) that the GET request is not well formed. This is likely because the filename is included as a query parameter.
If this becomes a problem for you, then I suggest instead you either:
- Embed the file name and filetype in the HTTP GET request headers (instead of as query parameters) and read them from the request headers on the server.
- Or using an HTTP POST request to submit the file name and type in the request body and then read them from the request body on the server.
I think that either one should help remove the warning.
Hope this helps.
@flyingsparx thanks for your quick response. I am getting past the XML not formed error by doing a 'POST' or setting 'mimeType' to 'text/plain'. However I'm getting the CORs error above only on Firefox.
It seems to work fine if I upload PDF's under 500kb, but only works 1 out of 10 times if the PDF is over 500Kb.