Question on using shell command to upload new G code to SD card

Hi all. I am kinda new to Smoothieboard and right now I am trying to access a smoothieboard via telnet by directly typing in commands in CMD. I am doing alright using most of the commands listed in the console-commands pages (link: http://smoothieware.org/console-commands) except the upload command. Once I connected to Smoothieboard, the prompt says the following:
uploading to file: /sd/erase.gcode, send control-D or control-Z to finish

Can anyone tell me what am I supposed to do in order to upload a snippet of gcode to the existing file in the SD using this upload command? I also attach a screenshot of this prompt. Any help is greatly appreciated. Thanks!

I tried manually type in some text followed by this prompt and hit ctrl-D or ctrl-Z on keyboard. But nothing happens. It seems like the upload command wasn’t finished. I am assuming I am doing the wrong way to use this command.

(I’m just a forum site admin, I don’t know smoothie, but…) Typically on most systems the control-d has to be on a line of its own, so you have to press “enter” before pressing “control-d”

Thanks for that info. I will try it out later this week. Really appreciate that.

upload only works over the USB serial, not over telnet. there are other ways to upload with network enabled, like over HTTP POST

You can check the way the web interface uploads files via http. You can upload files directly there, or if you want to stick to the command line you might be able to teach wget or curl to do the upload ( if you want me to help figure out how to do that tell me ).
I also can imagine that you might be able to use the “traditional” SD card upload commands to upload a file over telnet : https://reprap.org/wiki/G-code#M28:_Begin_write_to_SD_card You might have to read the source code of software such as pronterface to learn how it does this, as I’m not sure the documentation has clear information on practically doing this. Actually if you find online, or figure out, a snippet of code explaining how to use those codes to upload a small gcode file, I would love if you gave me that snippet so I can use it to improve the smoothie documentation.
And btw the M28 and other related SD card upload gcodes can also be found on the smoothieware wiki, maybe having both the reprap and smoothieware information on them might give you a better picture