upload - Why would php://input truncate? -
i have line $input = fopen( 'php://input', 'r' );
in code uploads.
when file done uploading, check against $_server['content_length']
see sent expected. content_length
, size of upload file started not match randomly ( once every 20 minutes people uploading ).
i logged , saved mismatches , found files unable opened, while downloaded , cut off. 1 opened in photoshop warned document damaged.
is there server config should looking may have been changed?
i tried replicating shutting browser tabs , things of nature still not replicate error.
we uploading via ajax post. post
body upload source.
it sounds me load/networking issue. either there latency issue/timeout issue users trying upload , server not responding.
usually it's not ajax blame, rather server (maybe not php) . think there drops in places of packets coming server. can limitation in datacenter (ex. bandwith cap.) or limitation on server itself.
we optimize our server using following configuration. should work on linux distro:
edit /etc/sysctl.conf
file. add following lines in end:
net.ipv4.tcp_wmem= 10240 87380 12582912 net.ipv4.tcp_rmem= 10240 87380 12582912 net.core.rmem_max=12582912 net.core.wmem_max=12582912 net.ipv4.tcp_max_syn_backlog=100000
you can use following manual ibm better understand how tune linux: http://www.redbooks.ibm.com/redpapers/pdfs/redp4285.pdf
also,
i log client's browser version. might format sent server depends on ajax different 1 browser other. since didn't specify ajax code it's hard assume what's ajax doing upload files.
Comments
Post a Comment