size) == 1; // File uploaded! var: 'temp_file_upload' = (file_uploads -> get: 1); // grab first file (only!!!) var: 'Temp_FilePath' = ($temp_file_upload -> Find:'upload.name'); // grab temp file name (on server) var: 'Temp_FileRealName' = ($temp_file_upload -> Find:'upload.realname'); // grab file name on client var: 'Temp_FileSize' = ($temp_file_upload -> Find:'upload.size'); // grab file size var: 'Temp_FileType' = ($temp_file_upload -> Find:'upload.type'); // grab mime file type var: 'Kat' = action_param: 'category'; var: 'Beskr' = action_param: 'file_note'; // set file name of uploaded file, strip off any path no matter of / or \ platform var: 'upload_filename' = $Temp_FileRealName -> (split: '/') -> last -> (split: '\\') -> last; var: 'filesufix' = '.' + ($upload_filename -> (split: '.') -> last) + '.'; var: 'fileOk' = ('.asx.doc.rtf.xls.pdf.gif.jpg.jpeg.png.eps.sit.zip.shtml.') ->(Contains: $filesufix) ; // HŒrdkodade filtyper OBS!! Sista punkten!! var: 'fileNameOk' = (String_ReplaceRegExp: ($upload_filename), -Find='[a-zA-Z0-9-_]',-Replace='', -EncodeNone) ; // Endast a-z, A-Z, 0-9, - och _ och en punkt! if: ($fileOk && $Temp_FileSize < (5*1024*1024+1) && $fileNameOk=='.'); // File name ending and size OK! inline: -Add, -Database='cms_light', -Table='file_upload', -username = 'cms_light', -password = 't7-11.ty', 'file_name'= $upload_filename, 'file_note'= $Beskr, 'file_type'= $Temp_FileType, 'file_size'= $Temp_FileSize, 'category'= $Kat; var: 'new_folder_id'= (keyfield_value); /Inline; var: 'n1' = $new_folder_id % 100; var: 'n2' = $new_folder_id / 100; var: 'n3' = $n2 / 100; var: 'n2' = $n2 % 100; var: 'new_folder'= $n3 + '/' + $n2 + '/' + $n1; var: 'FolderPath' = '/cms_stuff/' + $new_folder + '/'; // OBS! Privileger fšr Lasso var: 'FinalPath' = $FolderPath + $upload_filename; // OBS! Privileger fšr Lasso var: 'ftp_u' = 'uploader2'; // ftp user var: 'ftp_p' = 'mojs7sjom'; // ftp psw var: 'server' = 'include.adm.gu.se'; // server fšr ftp & web!! var: 'ftp_url' = 'ftp://' + $server + '/' + $new_folder + '/' + $upload_filename; // ftp url inline: -username='cms_uploader', -password='ker5.89f'; File_Control; file_create: $FolderPath, -fileoverwrite; var: 'myError' = $myError + ' Dir: ' + (File_CurrentError: -ErrorCode) +':'+ (File_CurrentError); FTP_PutFile: -URL=$ftp_url, -File=$Temp_FilePath, -Username=$ftp_u, -Password=$ftp_p; var: 'myError' = $myError + ' FTP: ' + (File_CurrentError: -ErrorCode) +':'+ (File_CurrentError); /File_Control; /inline; include:'upload_ok.lasso'; abort; else; include:'upload_nok.lasso'; abort; /if; include:'upload_nok.lasso'; abort; /if; include:'upload_nok.lasso'; abort; ?>