duanshan3427 2014-10-17 19:25
浏览 23
已采纳

一次处理多个用户的文件(后勤问题)

Hey my app creates files on server that are shown to users right away in html element called iframe. So far I have been storing all files into same folder, overwriting old ones each time user requested new one. Problem is that if more than one user tried to generate file at once, one of them might not get the right file, or no file at all. I guess i should create random temp folder for each generation of files. That would work, but my server might get filled up really quickly in like 100 generations of files. I need to delete this random temp folder once user is done loading up file in iframe, but how do I call php function on load?
Any other alternative method/idea, would help me alot. How do others handle such problems?

  • 写回答

1条回答 默认 最新

  • douyiyi5284 2014-10-17 19:45
    关注

    I would create one single temp folder, and generate random file names (md5, GUID, don't matter).
    The same script that generate the file on the folder to visualization, before the generation itself, should check all the files on the folder, excluding all the files which were generated >= 1 day ago.

    Check the filemtime function and this question if you have any doubts about how to get the file creation/modification date.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog