Upload fixed

Upload now first to /tmp/ and only after saving to /upload/ (using the
expression manager). Javascript code moved back to main.js.