/* FILEUPLOAD - Part Client by iri - http://www.irizone.net july 2007 under GNU/GPL v3 licence */ typeof upextension = [S r1];; typeof upsize = I;; var isreg = 0;; fun makefilter(l)= if l == nil then "\0" else strcat strcatn (hd l) :: "\0*" :: (hd l) :: "\0" :: nil makefilter tl l;; fun endUpfile(state, file)= if state then _DMSevent this "upfileok" file nil else _DMSevent this "upfilefailed" file nil;; fun cbUpfile(from, action, param, others, tag)= if (_checkpack param) != nil then let _FILEOpen _channel _checkpack param -> f in let _FILESize f -> size in let getExtensionFromFile param -> ext in if ((1024 * upsize) >= size) && (upsize != nil) && (is_string_in_list upextension ext) && (isreg == 1) then let getPathFile param nil -> [_ name] in let zip _getpack _checkpack param -> content in ( _DMSupload this name content mkfun2 @endUpfile param; _FILEClose f ) else _FILEClose f else 0;; fun cbChoiceFile2(obj, u, p)= if p != nil then cbUpfile nil nil _PtoScol p nil nil else nil;; fun cbChoiceFile(from, action, param, others, tag)= if isreg then _DLGrflopen _DLGOpenFile _channel nil nil nil makefilter upextension @cbChoiceFile2 0 else nil; 0;; fun IniDMI(param)= _DMSdefineActions this ([ "upfile" @cbUpfile ]) :: ([ "choiceFile" @cbChoiceFile]) :: nil; 0;; fun __unregister()= set isreg = 0; set upsize = nil; set upextension = nil;; fun __register(s)= set isreg = 1; let strextr s -> l in ( set upextension = hd l; set upsize = atoi hd hd tl l );;