ID:1670829
 
(See the best response by Kaiochao.)
Code:
mob/verb/Example()
var/a = input("Find a soundfile.") as sound


Problem description:

How would I go about determining the size of the chosen sound file?
Best response
I don't think "as sound" is valid, since it should be "as file", which is unfortunate because you can't limit the file types visible in the file selector.

Anywho, whenever you ask a player to choose a file through "input() as file", the client.AllowUpload() event is called, giving you the name and size of the file. If you return false, the file is rejected. Check the ref for more info.
Thanks, and by the way "as sound" is valid.
Try using length(a) and probably use - http://www.byond.com/developer/Y2kEric/y2k_ByteConverter - to determine the size in MB etc

Just a note, you can't determine the size BEFORE downloading it for this to work the server will need to download the said file.

I would use a JavaScript solution with World/Topic in the browser to determine the size Client side before sending it.
In response to A.T.H.K
A.T.H.K wrote:
Try using length(a) and probably use - http://www.byond.com/developer/Y2kEric/y2k_ByteConverter - to determine the size in MB etc

Just a note, you can't determine the size BEFORE downloading it for this to work the server will need to download the said file.

I would use a JavaScript solution with World/Topic in the browser to determine the size Client side before sending it.

As Kaiochao pointed out, AllowUpload() gives you the size of the file before actually allowing it to be uploaded to the server.
Oh I missed that, my bad!