I set up this multiple file upload plugin (https://github.com/blueimp/jQuery-File-Upload) on my local machine (mac osx default server). Everything is working perfectly, when I upload an image I get back this response
[{
"name":"subaru-wrx-poster-i3(1).jpg",
"size":142583,"type":"image\/jpeg",
"url":"http:\/\/shipwatchpointe.dev\/bundles\/jupload\/uploads\/files\/52\/subaru-wrx-poster-i3%20%281%29.jpg",
"thumbnail_url":"http:\/\/shipwatchpointe.dev\/bundles\/jupload\/uploads\/thumbnails\/52\/subaru-wrx-poster-i3%20%281%29.jpg",
"delete_url":"http:\/\/shipwatchpointe.dev\/upload\/upload\/?file=subaru-wrx-poster-i3%20%281%29.jpg&_method=DELETE",
"delete_type":"POST"
}]
However, I just pushed to a staging area on an EC2 instance and now I'm getting this response
//
With an error on the frontend that says...
SyntaxError: Unexpected token /
I threw a bunch of dies everywhere I could think of but I'm not reaching them and still getting the same response. The EC2 instance is running Ubuntu 12.10 and I ensured that in /etc/mime.types that application/json json is there, but for some reason it looks like it is still trying to render it as html and throwing me that error. What could be the issue here on my staging server that's not present on my local server? I can paste my code, but there are a lot of snippets that I suspect may be causing the issue.
Edit Here are the response headers on my local server (works fine)
Accept-Ranges:bytes
Connection:Keep-Alive
Content-Length:1532
Content-Type:image/png
Date:Wed, 03 Apr 2013 18:13:47 GMT
ETag:"30d598-5fc-4d978d09b8a80"
Keep-Alive:timeout=5, max=100
Last-Modified:Wed, 03 Apr 2013 18:13:46 GMT
Server:Apache/2.2.22 (Unix) DAV/2 PHP/5.3.15 with Suhosin-Patch mod_ssl/2.2.22
OpenSSL/0.9.8r
Here are the response headers on my staging server (not working)
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:23
Content-Type:text/html
Date:Wed, 03 Apr 2013 18:07:24 GMT
Keep-Alive:timeout=5, max=100
Server:Apache/2.2.22 (Ubuntu)
Vary:Accept-Encoding
X-Powered-By:PHP/5.3.10-1ubuntu3.6
There may be an issue with reading files here. Check/Grep your staging server for any source files that have the double slash //
in weird places (say the beginning of a PHP file).
It may be running into that file, erroneously printing those slashes, and ending output.
If this is the case, the BlueImp code is more than likely not being seen by the server, hence all those plain and simple output headers that have absolutely nothing to do with the upload.