We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

file transfer progress function | Forum

Marcus
Marcus Aug 20 '20
hi folks is there a function to get the amount of dsta being transferred between user and server? 
dave Leader
dave Aug 20 '20
Topic was moved from General Questions.
dave Leader
dave Aug 20 '20

php does have some new functions for this but i am not familiar with how they work yet. 


This has been a long standing battle because everyones upload speed is different so the only way that i am aware of to get that speed is to place a file on the users computer during the process and upload it to see the speed.  But that causes privacy issues because in order to do that legally you have to ask the user each time if they agree to that process. 


So basically the way i understand it, its a best guess ballpark kind of thing.  I know that youtube has a process after the original process has reached 100% and my feeling is that they use this extra time to finish the offset between userside and serverside.. but i could be wrong on that one.


I know there are probably new fresh techniques to come up with the answer but i am not aware of it yet, maybe someone out there can teach me..


This is why on my video plugin i allow the admn to decide the overall speed and i also have a default speed i use as a general global average.   Sometimes the bar is half way when it completes, sometimes the bar is all the way and it just works out perfect, and sometimes the bar is at 100% and sits there for a half a minute till its done.


I know that SD was looking at doing a progress bar deal for uploads some time back as a plugin, so he must know the secret :)


But my best advice for now is to look at the php manual for the new functions, i hear they do great things.

The Forum post is edited by dave Aug 20 '20
Marcus
Marcus Aug 20 '20
hi dave this is how im ginna do it... on file select get size. now monitor transfer data aka upload and deduct from total file size. 
dave Leader
dave Aug 20 '20

be careful depending on $_FILES['size'] or ['type'].  I know that type has a bad reputation for NOT being dependable but and im not sure about size, if its that bad or not...


i assume your going to use both php, js, and ajax so you can do it on the fly?


I think your still going to run into some issues and your gonna need some kind of offset process because even if you monitor the stream as a middleman for example, the time it takes to get to the server and actually be resourced i dont think can be measured unless one of those new php functions does that.

The Forum post is edited by dave Aug 20 '20
Marcus
Marcus Aug 20 '20
mostly its ginna be js. it dont have ti be precise just enough for users to know file is getting uploaded. spinner sucks lol
dave Leader
dave Aug 20 '20
If its js dont forget to include the noscript warning... :)
Marcus
Marcus Aug 21 '20
Thanks buddy.