Sample code (from one of the other treads):
Questions:
1. Can I use get-binary-data function with Progress v10.0? (I get compilation error)
2. When I check line: *** cfile = get-value('UploadFile') *** cfile value is just file name and not full file path, so I have problems finding file. How to get full path of the file?
Note: I have task to add upload file option to one form (And I'm relatively new to WebSpeed, HTML and JavaScript). I would appreciate any suggestion.
Code:
<HTML>
<BODY>
<script language="SpeedScript">
DEFINE VAR mFile AS MEMPTR NO-UNDO.
DEFINE VAR cfile AS CHAR NO-UNDO.
IF get-value('upload') <> '' THEN do:
ASSIGN mFile = get-binary-data("UploadFile").
IF mFile <> ? THEN DO:
{&out} 'Uploaded to: ' + get-config("fileUploadDirectory":U).
ASSIGN cfile = get-value('UploadFile')
cfile_dest = get-config("fileUploadDirectory":U) + '\' + entry(num-entries(cfile),cfile,'\').
{&out} 'Uploaded as: ' + cfile_dest.
COPY-LOB FROM mFile TO FILE cfile_dest NO-CONVERT.
END.
else
{&out} 'Invalid file uploaded: ' + get-value('UploadFile').
END.
</script>
<FORM ENCTYPE="multipart/form-data" ACTION="fileupload.r" METHOD="POST">
<input type=file name="UploadFile">
<INPUT type="submit" value='upload' name="upload">
</FORM>
</BODY>
</HTML>
1. Can I use get-binary-data function with Progress v10.0? (I get compilation error)
2. When I check line: *** cfile = get-value('UploadFile') *** cfile value is just file name and not full file path, so I have problems finding file. How to get full path of the file?
Note: I have task to add upload file option to one form (And I'm relatively new to WebSpeed, HTML and JavaScript). I would appreciate any suggestion.