开发者

php file upload and virus scan and save to ftp

开发者 https://www.devze.com 2023-03-06 17:48 出处:网络
I am trying to upload a file via HTTP and run it through a virus scan and immediately move to a ftp location. Here are the basic steps,

I am trying to upload a file via HTTP and run it through a virus scan and immediately move to a ftp location. Here are the basic steps,

  1. Upload via HTTP
  2. Do the virus scan on the php tmp directory (upload_tmp_dir) using 开发者_Python百科php command line functions.
  3. Move the file directly to ftp from the tmp directory after the virus check.

You might notice I am not doing a move_upload_file(), is this the best way to do it ? Or should I do steps 2 & 3 after I do a move_upload_file().

If I should not do it before move_upload_file() then what would be the reason ?

Thanks


I think that doing it before move_upload_file is appropriate. If you move it first, then you've put a file into your FTP directory which may have a virus; for the length of time that you scan, an unsafe file is available.

Also, if you do it before move_upload_file and find a virus, you can just leave it there and PHP will tidy up for you; no need to call unlink yourself :)

0

精彩评论

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