An all-optical controlled attenuation effect in an all-fiber system based on ionic liquid-filled photonic bandgap fiber (ILF-PBGF) is observed and demonstrated. The ILF-PBGF is formed by infusing a temperature-sensitive high-index ionic liquid into the cladding holes of the microstructured optical fiber. With the interactions between the controlling light and the highindex liquid columns, the bandgap drift of ILF-PBGF was observed, and an extinction ratio of about 8 dB was obtained at 1540 nm. Experimental investigations reveal that the attenuation is arose from the refractive index changes induced by thermal effect of the functional material.