[0001] [0002] [0003] [0004] [0005] [0006] [0007] [0008] [0009] [0010] [0011] [0012] [0013] [0014] [0015] [0016] [0017] [0018] [0019] [0020] [0021] [0022] [0023] [0024] [0025] [0026] [0027] [0028] [0029] [0030] [0031] [0032] [0033] [0034] [0035] [0036] [0037] [0038] [0039] [0040] [0041] [0042] [0043] [0044] [0045] [0046] [0047] [0048] [0049] [0050]
$! CGIUTL.C Usage Example 2 $! Submitted by example form WASD_ROOT:[SRC.MISC]CGIUTL_EXAMPLE2.HTML $! 28-DEC-2008 MGD bugfix; CGI response for DEBUG=1 $! 19-APR-2000 MGD initial (demonstrate file upload) $! $ Debug = 0 $ if Debug $ then $ write sys$output "Content-type: text/plain" $ write sys$output "" $ set verify $ endif $! $ say = "write sys$output" $ CGIutl = "$cgi-bin:[000000]cgiutl" $! Locate a unique scratch file somewhere we know the server account can write. $ FileName = "wasd_scratch:CGIUTL" + f$cvtime(,,"year") + - f$cvtime(,,"month") + f$cvtime(,,"day") + f$cvtime(,,"hour") + - f$cvtime(,,"minute") + f$cvtime(,,"second") + - f$cvtime(,,"hundredth") + ".TXT" $! $ if Debug then show symbol * $! Use the CGIUTL utility to process the POSTed body contents. $ CGIutl /multipart /field=file /symbols /output='FileName' $ if Debug then show symbol * $! $ if f$search(FileName) .eqs. "" $ then $ say "Content-Type: text/html" $ say "" $ say "ERROR generating upload file!" $ exit $ endif $! $ set noon $ on error then goto CleanUp $! $ say "Content-Type: text/plain" $ say "" $ say "This is the created file:" $ directory/full 'FileName' $ say "" $ say "And here are the specific symbols created from the request:" $ say "" $ show symbol cgiutl%* $ say "" $! $ CleanUp: $ if f$trnlnm("FileHandle","LNM$PROCESS") .nes. "" then close FileHandle $ if f$search(FileName) .nes. "" then delete /nolog /noconfirm 'FileName';*