最近在寫一個小玩具時,想要上傳之後繼續 AJAX 的動作。
卻發現一直 406..
丟關鍵字下去找,才發現一件事實...
The thing is that you cannot post a multipart form via AJAX. This is not a rails' limitation. In order to circumvent this, you need to use an iframe technique (which can be easier with responds_to_parent plugin) or use a technology like Flash or Silverlight.
可惡,讓我 debug 那麼久才發現這是 javascript 限制...
不過後來下面有好心鄉民提供了解決方法。可以用一樣的 API 硬幹...
暫無回應。