简体   繁体   中英

does php5.2 APC_UPLOAD_PROGRESS work when sites are load balanced?

I'm wanting to use APC_UPLOAD_PROGRESS for showing progress of file uploads in PHP > 5.2.

I'm wondering if I will run into the same sort of scenario as SESSION handling where referencing APC_UPLOAD_PROGRESS could get weird if the request goes to any one of my boxes that are taking requests.

What are its limitations? Should i use it? will it work in my scenario?

Yes, you'll run into the same issue -- PHP upload progress isn't visible across servers, so you'll get inconsistent results if users end up with requests split across servers.

Your best bet will be to use some sort of consistent hashing (based either on the session or remote IP) which guarantees that all requests from a user are always routed to the same server, or to route all uploads to a single server. Alternatively, you may want to investigate HTML5 chunked uploads, which will allow you to display upload progress on the client side, as well as supporting larger uploads.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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