How to sequence events in PHP for uploading files to amazon S3

[亡魂溺海] 提交于 2019-12-08 13:44:27

For big files the time it takes to upload them will probably be higher than the script's max_execution_time.

You could just use the set_time_limit() function but it's still probably not a good idea for web pages as the script would just "hang" there without any user feedback (output to the browser).

This would probably be nicer:

  1. use set_time_limit() so the script doesn't die.
  2. Store the file name in a temporary location (DB, session, etc) and get a unique ID for it
  3. Output a page with some AJAX code to (repeatedly) query a second script for the file's status (FINISHED, FAILED, UNDEFINED?)
  4. On the original script, wait for the action to finish and update the DB with the result.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!