Nel codice che ti ho scritto... Cambia enctype:"text/plain" in enctype:"multipart/form-data"