Hi, im trying to check the file size for http upload.
The upload is working fine but im having some dificulties with the filesize check, i belive theres no way to check that before the upload so i was doing something like this.
But i only i only get the response.write "1".HTML Code:Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject") Set MyFile = ScriptObject.CreateTextFile(pasta & nome_ficheiro) For i = 1 to LenB(ficheiro) MyFile.Write chr(AscB(MidB(ficheiro,i,1))) Next 'intMaxFileSize = 102400 response.write "1<br>" Response.Write(MyFile.Path) Response.Write(MyFile.Size) If MyFile.Size > 102400 Then response.write "<br>2" response.write "&MyFile.Size&" ScriptObject.DeleteFile(pasta & nome_ficheiro) response.Write("<script>alert('File too big, Please upload image up to 100kb!');location.href='javascript:history.go(-1)'</script>") Else
This is not ideal after all it allow the upload and only than do the check.
Can anyone see whats wrong with this script or if theres a way to check the filesize before upload?
thanks


Reply With Quote
Bookmarks