Attachments (Limiting size and type)

This is the final major hurdle before I release my web app.

How do I limit the size and type of attachments on a web app?

I realize that size may only be accomplished only after submission via a server agent. Or is there some Javascript method that could work here?

Regarding attachment types, I see no reason why this cannot be checked before submission.

I’ve done some reading and borrowing and implmented this JS function and call, but document.forms[0].uploadfile.value never seems to have a value.

Any suggestions?


function TestFileType( fileName, fileTypes ) {

dots = fileName.split(".")

//get the part AFTER the LAST period.

fileType = "." + dots[dots.length-1];



msg = (fileTypes.join(".").indexOf(fileType) != -1) ?

"" : 

"Please only upload pictures of type: \n\n." + (fileTypes.join(" .")) + "\n\nPlease select a new file and try again."

return (msg)

}


file = document.forms[0].uploadfile.value

if (file) {

msg = TestFileType(file, ['gif', 'jpg', 'png', 'jpeg'])

if (msg != "") {

	alert(msg)

	return false

}

}


Subject: Attachments (Limiting size and type)

Check out Jake’s site:

http://www.codestore.net

I believe he has some code for this purpose.

Subject: RE: Attachments (Limiting size and type)

Actually, that’s where most ofm y code came from. (Thanks, Jake)

However, it does not seem to work in R6.

Any suggestions?

Subject: RE: Attachments (Limiting size and type)

Take a look at DLI.uploader at http://www.dlitools.com