Methylammonium lead triiodide perovskite (CH₃NH₃PbI₃, MAPbI₃) has been emerging as an easy processing and benign defect material for optoelectronic devices. Fiber-like perovskite materials are especially in demand for flexible applications. Here we report on a kind of polyacrylonitrile (PAN)/MAPbI₃ composite fiber, which was electrospun from the mixing solution of PAN and MAPbI₃. The absorption edge and optical gap of the PAN/MAPbI₃ composite fibers can be easily tuned as the ratio of the perovskite changes. Both the moisture stability and the thermal stability of the perovskite are improved with the protection of PAN polymers. Flexible photodetectors based on this perovskite fiber were fabricated and analyzed. The photoresponse of the detector was highly sensitive to broadband visible light, and reached 6.5 μA W-1 at 700 nm with a voltage bias of 10 V. Compared with pure MAPbI₃ photodetectors, this composite fiber photodetector has much-improved stability and flexibility, which can even be used to detect motion-related angular changes.