Header name must be an RFC 7230 compatible string

If you don’t debug by a PHP debugger (you should learn it), you better use the good old method:

  1. Enable Debug, run the process again, when you see the error, go to the log to check the complete server side error.
  2. Press F12 in your brower and go to the Console panel to check for client side JavaScript errors.
  3. Check HTTP response, select the “jupload” request and try to find PHP errors in the HTTP Response under the F12 → Network → Response panel.
    You should provide result of all three above in your next post.