Can I display the actual upload speed in the web interface?

Hey!

Right now when uploading in the web interface the usual upload percentage and remaining time is shown. I was wondering if it’s possible to display the actual upload speed in kb/s while uploading to give the user a better idea on the servers current performance. This would be useful to maybe postpone a large file upload to a later time or just resort to other means of transferring files if a cloud synchronisation isn’t really necessary at the time. I tried playing around in the php.ini but I couldn’t find any option or other helpful posts on this topic. Every answer is greatly appreciated!

Also, if this is not an actual option provided in Nextcloud right now, is there a way for me to suggest it as a feature?

System info:
Nextcloud Version 11.0.2 stable
Ubuntu 16.04 Xenial
Apache 2.4.18
PHP 7.0.15

Sincerely,
sebastian.klein

1 Like

That sounds like an interesting feature. I don’t think it’s possible right now (without modifying the code), but you could request it on Github by adding a new issue and writing the specific details about what you want and why it would be useful.

I would love this feature. Please provide the link to Github if you post a feature request.

Hey guys!

I’ve just opened a feature request issue on github. Feel free to contribute:

Sincerely,
Sebastian Klein

3 Likes

1 Like

And now show us, how you achieved that :wink: :stuck_out_tongue:

Now that looks amazing. I would second @Schmu in asking for the solution :wink:

Hi All,

I came across this while looking for the same thing.

I couldn’t find an answer to this so looked into it and this is how I got it working.

Nextcloud 14.0.4 / Ubuntu 18.04.1 LTS + MATE

All we are going to do is add lines to a file which will replace the displayed time remaining data with upload data.

Method - you’ll need admin access for this:

  1. goto the folder of the file location:

    cd /var/www/html/nextcloud/apps/files/js/
    
  2. make a backup copy of the upload file

    sudo cp file-upload.js file-upload.js-original
    
  3. edit the upload file

    sudo nano file-upload.js
    

    I’m using nano text editor, use whatver floats your boat

  4. NB: in nano - pressing Ctrl + C will show you the current line number, and Alt + G will prompt for a line number to jump to

    goto line 1139, you want to find this line:

    var h = moment.duration(smoothRemainingSeconds, "seconds").humanize();
    if (!(smoothRemainingSeconds >= 0 && smoothRemainingSeconds < 14400)) {
    		// show "Uploading ..." for durations longer than 4 hours
    		h = t('files', 'Uploading …');
    }
    

    this is displaying the upload information

  5. after the above line add one of the following as required:

    a) xfr speed after the time remining:

time%20remianing%20and%20transfer%20speed

		// add xfr speed to time remaining
		h = h + t('files', ' @ {bitrate}' , {
					bitrate: humanFileSize(data.bitrate / 8) + '/s'
				});
		// ========================================
	
b)	xfr speed replaces time remaining:

transfer%20speed

		// xfr speed replaces time remaining
		h = t('files', '{bitrate}' , {
					loadedSize: humanFileSize(data.loaded),
					totalSize: humanFileSize(data.total),
					bitrate: humanFileSize(data.bitrate / 8) + '/s'
				});
		// ========================================
	
c)	uploaded of total size and xfr speed replaces time remaining:

(image would be as per Marcel_Panac's above)

		// uploaded of total size and xfr speed replaces time remaining
		h = t('files', '{loadedSize} of {totalSize} ({bitrate})' , {
					loadedSize: humanFileSize(data.loaded),
					totalSize: humanFileSize(data.total),
					bitrate: humanFileSize(data.bitrate / 8) + '/s'
				});
		// ========================================

To return to the original display, comment out or delete the added lines.

:slight_smile:

2 Likes

Hi to All,

has anyone of you tried the described above with Version 16?

I tried a lot, asked google, but I can’t get to run it.
There is an upload speed but in something like bit per second.
It would be better to get it in MB/s or GB/s.

Thanks for any tipp or link to information.

This is my very fist question to this community.
Please don’t hesitate to let me know in the case I miss any of the good community rules.

Hey, i just tried the solution from Drussius, works perfect for me with Nextcloud 16.01 !

Dont forget to log out once in your browser…

Thanks @Drussius for this easy solution :star_struck:

Hi wicki,
thanks for your answer.
This is what I get:
grafik
Code from Line 1164:

  • var h = moment.duration(smoothRemainingSeconds, “seconds”).humanize();
  • if (!(smoothRemainingSeconds >= 0 && smoothRemainingSeconds < 14400)) {
  •   // show "Uploading ..." for durations longer than 4 hours
    
  •   h = t('files', 'Uploading …');
    
  •   // add xfr speed to time remaining
    
  •   h = h + t('files', ' @ {bitrate}' , {
    
  •   bitrate: humanFileSize(data.bitrate / 8) + '/s'
    
  •   });
    
  • }
    Any idea?
    Could you send me your modified code.

Testing with Opera, Firefox, Edge.
I rebooted the server - no change.
Maybe there are server settings to modify? Modules to install/aktivate?
How can I check this?

var h = moment.duration(smoothRemainingSeconds, "seconds").humanize();
if (!(smoothRemainingSeconds >= 0 && smoothRemainingSeconds < 14400)) {
// show "Uploading ..." for durations longer than 4 hours
h = t('files', 'Uploading …');
}
// add xfr speed to time remaining
h = h + t('files', ' @ {bitrate}' , {
bitrate: humanFileSize(data.bitrate / 8) + '/s'
});

Just compare your code and Drussius code once again…
You see what I see? :wink:

} :thinking:

Hopefully thats your issue… good luck

Wicki

Hello wicki, yes it works. Thank you.

did it on 16.0.3.

It is so self satisfactory to see your upload speed when using a 10 Gb/s optical network.

Tried this today and can no longer see any files through the web UI. I get the all the nextcloud interface but nothing in the main file browser area.

I replaced the file-upload.js with the original that I backed up before starting and have tried restarting the server and dockers a few times.

Any ideas how to fix this?

Thanks.

Hi All,

Quick update as I did a fresh install with version 21, so I thought I’d update as it’s slightly different.

The above still works but…, it’s now line circa 1202 for:

       var h = moment.duration(smoothRemainingSeconds, "seconds").humanize();...

The line after should now read:

      // uploaded of total size and xfr speed replaces time remaining
      h = t('files', '{loadedSize} / {totalSize} ({bitrate})' , {
              loadedSize: OC.Util.humanFileSize(data.loaded),
              totalSize: OC.Util.humanFileSize(data.total),
              bitrate: OC.Util.humanFileSize(data.bitrate / 8) + '/s'
      });
      // ========================================

The only difference is the need for OC.Util. (note the full stops) to prefix the variables humanFileSize…:

     e.g. OC.Util.humanFileSize(data.loaded)

So adjust as required on your desired display, and you are back in business.

:partying_face:

Why i have add all this code but still not working on my docker compose nextcloud.

var h = moment.duration(smoothRemainingSeconds, “seconds”).humanize();
if (!(smoothRemainingSeconds >= 0 && smoothRemainingSeconds < 14400)) {
// show “Uploading …” for durations longer than 4 hours
h = t(‘files’, ‘Uploading …’);
}
// uploaded of total size and xfr speed replaces time remaining
h = t(‘files’, ‘{loadedSize} / {totalSize} ({bitrate})’ , {
loadedSize: OC.Util.humanFileSize(data.loaded),
totalSize: OC.Util.humanFileSize(data.total),
bitrate: OC.Util.humanFileSize(data.bitrate / 8) + ‘/s’
});

image

still not work and sometime it work so are there any procedure to place it and restart to make it work.

Hi, I want the same functionality in my Nextcloud version 27 where upload speed must be shown in the progress bar, I have tried a lot and spent over a week, but no success. Please someone help me to achieve me to get this functionality.

1 Like

Same here please share how to have transfer rate in interface