开发者

track results of $zip->expandTo in order to log files?

I am using the PHP zipArchive class to uncompress files and store them on a server, but I have a couple of problems

extractTo method only returns true开发者_如何学运维 or fales, I need a list of the file names and types to that I can

  • Check they are valid file types for the function
  • Connect the files with database objects for retrieval

Any ideas?


you can extend the class, adding a logging function which then passes through the params to the extractTo method...

see: http://php.net/manual/en/keyword.extends.php


Answering my own question for completeness, the DirectoryIterator is the best way. The process being:

  • Create Temp folder
  • Extract
  • Check with DirectoryIterator class
  • Move to Permanent location
  • Delete Temp folder
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜