[Display omitted] • This paper focuses on a novel analytical method based on packed-nanofibers solid-phase extraction coupled with HPLC-FLD to determine aflatoxins G1, B1, G2, B2 in foods, which contribute vitally to the application of nanoscience and material technology on the agricultural and food chemistry and analytical field. • This study confirmed that the as-synthesized electrospun nanofibers as adsorbent displays preferable potential practical application in the simultaneous pretreatment and analysis of toxins from various samples. • Under optimized conditions, one-step sample pretreatment integrating extraction, purification, enrichment and elution, was realized. The method can simultaneously process 12 samples within 5 min on a semi-automatic array SPE processor. A novel analytical method based on nanofiber-packed solid-phase extraction (PFSPE) combined with HPLC-FLD has been successfully developed and applied to determine aflatoxin B1, B2, G1, G2 in foods. In order to effectively adsorb analytes from complex food matrices, four types of nanofibers based on skeleton of polystyrene–polyvinyl pyrrolidone were prepared by electrospinning and applied as adsorbent to home-made solid-phase extraction device. The effects of type of nanofibers, pH of sample, type and concentration of salt ion, type of activation solvent, type and volume of eluent, amount of nanofibers, and extraction time on the adsorption/desorption were investigated and optimized. Under optimal conditions, the method showed satisfactory linear relationship, with limits of detection (LODs) of 0.07–0.17 ng g−1, intra-day and inter-day RSDs for spiked samples of 1.3–8.0 % and 1.9–5.8 %, and absolute recoveries in the range of 60.1–98.4 %. The results presented the great potential to be utilized to determine AFs in foodstuffs. [ABSTRACT FROM AUTHOR]