ID:167654
 
As a not-so-hypothetical example, say someone wishes to upload a music file so that others can hear it. Is it possible to check the filesize before it gets sent (so that if it's bigger than a specified size, it'll get rejected)?
Sarm wrote:
As a not-so-hypothetical example, say someone wishes to upload a music file so that others can hear it. Is it possible to check the filesize before it gets sent (so that if it's bigger than a specified size, it'll get rejected)?

Nope.

Lummox JR
length(file) will return the byte size of the file.
mob/verb/crudeuploadforexample(o as file) if(length(o)>49999) return
In response to Artemio
Wow, that looks so simple. I feel dumb now.
In response to Artemio
Artemio wrote:
length(file) will return the byte size of the file.
> mob/verb/crudeuploadforexample(o as file) if(length(o)>49999) return



Haey...thats a pretty handy piece of info.
In response to Lummox JR
To elaborate a little, the file has to be totally uploaded to get the size on it, afterwards you simply need to check the length() and fdel() the oversized file.
In response to Lummox JR
Rather, would it be possible to have a few variables from the file sent to the server, such as name, size, etc... rather than uploading the file completely only to find that it's both stuck in the RSC which may be getting oversized and you don't want to use it (mainly for the reason of server limitations on files, such as certain extensions).
In response to Mechanios
Mechanios wrote:
Artemio wrote:
length(file) will return the byte size of the file.
> > mob/verb/crudeuploadforexample(o as file) if(length(o)>49999) return

Haey...thats a pretty handy piece of info.

Yeah, I never knew about this.

O-matic