modify function about insert attachment and test completed!!