pass state to javascript, fixing the upload page