Welcome Guest, Not a member yet? Register   Sign In
How to get file size before the file get upload?
#1

[eluser]helphelp[/eluser]
Hi, i just wondering is there any way to get the total file size when the user start to upload?

So i can calculate how many % till it finish?

i use the CI file uploading class

Thanks
#2

[eluser]Michael Wales[/eluser]
Not in PHP alone (since it's a server-side language). There are some threads around here about implementing SWFUpload, which is a Flash/Javascript solution that allows you to check filesize prior to upload.
#3

[eluser]helphelp[/eluser]
Thanks walesmd, i will look into it.

i just wondering, When the file begin to upload, will it put the "total file size" in the header? like in Content-Length field? Tell how much data is going to send?

Thanks
#4

[eluser]Thoer[/eluser]
It does, but php won't start processing while it's receiving post data, so it won't be able to stop it either. On the other hand you may be able to tell your webserver what filesize to except and I suppose (note that I don't know much about them!) they may cancel an uploading before it actually finishes.




Theme © iAndrew 2016 - Forum software by © MyBB