So I\'m attempting to get a progress bar on file uploads on my site. If I simply upload the resource
$.ajax({
url: $rootScope.URL, //Server script to proces
The header()
must be placed before ANY output is sent to the browser, once output is sent to the browser the header()
will actually throw a PHP warning which if you aren't seeing isn't being displayed or tracked.
Alternatively you can also do it through .htaccess which would be processed before any of your PHP scripts. This is going on the asumption that you are using apache for your webserver.
Header set Access-Control-Allow-Origin "*"
# below line shouldn't be needed as by default all of those are allowed,
# if you were doing PUT, TRACE, DELETE, etc then you would need it
Header set Access-Control-Allow-Methods "GET, POST, OPTIONS"