[英]File transaction handling in multiple image upload in codeigniter
我正在CodeIgniter中進行多個圖像上傳,我想創建一個文件事務處理系統來上傳圖像。 問題是,當我們在圖像之間選擇任何非圖像文件時,CodeIgniter將無法回滾任何系統以刪除上載的圖像。 我應該怎么做才能管理此圖像上傳?
當在允許的尺寸圖像之間上載任何較大尺寸的圖像時,也會發生相同的問題。 CI會上傳一些文件,並且當更大的圖像出現時,CI會給出一個錯誤,但直到之前的圖像將被上傳為止。
最終目標是,如果文件上傳之間發生任何錯誤,則所有過程都將回滾。
因此,如何像在MySQL中處理事務一樣管理該文件事務
使圖像上載功能足以處理它。 嘗試這樣的事情:
$fileNames = array();
// To hold the the file names of all the files available in $_FILES
$fileStatus = array();
// hold the file name wise status i.e. TRUE/FALSE like filename => status
// Put a check to ensure all files have a TRUE status, if any one fails then unlink (delete) all the uploaded file for the current session
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.