Note that there are some explanatory texts on larger screens.

plurals
  1. POError 403 when sending binary data via xhr
    primarykey
    data
    text
    <p>Im trying to send binary data to the server using Xhr sendAsBinary. WHen i test it from localhost it works with no glitches. But when it test from my share host server i get this response</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&gt; &lt;html&gt;&lt;head&gt; &lt;title&gt;403 Forbidden&lt;/title&gt; &lt;/head&gt;&lt;body&gt; &lt;h1&gt;Forbidden&lt;/h1&gt; &lt;p&gt;You don't have permission to access /mvc/control/upload.php on this server.&lt;/p&gt; &lt;p&gt;Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.&lt;/p&gt; &lt;/body&gt;&lt;/html&gt; </code></pre> <p>Its sending a request from the same domain, when i check the error log, i get the following</p> <pre><code>PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/timezonedb.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20090626/timezonedb.so: cannot open shared object file: No such file or directory in Unknown on line 0 </code></pre> <p>I thought maybe the problem is with my php files so used another url to a different file that it gives me the same error, i even tried entering a file path that doesnt exist, it just gave me the same error. my js looks like this </p> <pre><code>function upload(file,json_content,callback,prog,path) { var reader = new FileReader(); reader.readAsBinaryString(file); // alternatively you can use readAsDataURL var jc = JSON.stringify(json_content);// turning the json object to a string so that it be written to array buffer as binary var jc_size = jc.length;//the length of the stringified json object reader.onload = function(evt) { xhr = new XMLHttpRequest(); // send the file through POST xhr.open("POST", path, true); // make sure we have the sendAsBinary method on all browsers XMLHttpRequest.prototype.mySendAsBinary = function(text) { var f_size = text.length; var data = new ArrayBuffer(f_size+4+jc_size); //the length of the file plus the 1 byte code var ui32a = new Uint32Array(data,0,1); var ui8a = new Uint8Array(data,4,f_size); var ui8_jsn = new Uint8Array(data,4+f_size,jc_size); ui32a[0] = (f_size)&amp; 0xffffffff; var test = new Uint8Array(data,0,4); for (var i = 0; i &lt; f_size; i++) { ui8a[i] = (text.charCodeAt(i) &amp; 0xff); } for (var i = 0; i &lt; jc_size; i++) { ui8_jsn[i] = (jc.charCodeAt(i) &amp; 0xff); } if(typeof window.Blob == "function") { var blob = new Blob([data]); }else { var bb = new (window.MozBlobBuilder || window.WebKitBlobBuilder || window.BlobBuilder)(); bb.append(data); var blob = bb.getBlob(); } this.send(blob); } if(prog !== false) /*if progress is needed*/ { // tracking upload progress var eventSource = xhr.upload || xhr; eventSource.addEventListener("progress", function(e) { // get percentage of how much of the current file has been sent var position = e.position || e.loaded; var total = e.totalSize || e.total; progress = "#" + prog; $(progress).attr('max', total); var percentage = Math.round((position/total)*100); $(progress).css('width', percentage+"%").html(percentage+"%"); }); } // state change observer - after successfull upload..thentyu xhr.onreadystatechange = function() { if(xhr.readyState == 4) { if(xhr.status == 200) { callback(xhr.response); }else{ // process error } } }; // start sending xhr.mySendAsBinary(evt.target.result); }; } </code></pre> <p>any help will be appreciated, i tried contacting the webhost but they seem clueless</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload