繁体   English   中英

Codeigniter中多图像上传中的文件事务处理

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM