how to upload text file

Beginner

New Member
I want a program to upload text file from local system to Serve using Webspeed
User will specify the local file path. And the destination path will be default however the user should have a option to change it if he/she requires.

Version 9.1D
Server Unix
 

rstanciu

Member
You have to add a variable on the server side, in the WebSpeed configuration section:
Specifies a directory where WebSpeed servers can upload files to.

fileUploadDirectory=/tmp

The follow HTML snippet shows how to use this feature:
Code:
            <HTML>
                  <BODY>
                    <FORM ENCTYPE="multipart/form-data"
                          ACTION="http://<yourhost>/<msngr path>/<msngr>/ping"
                          METHOD="POST">
                      <INPUT type="file" name="filename"> <INPUT type="submit">
                    </FORM>
                   </BODY>
            </HTML>
By default this capability is disabled. To enable it specify an
upload directory. Only text file upload is supported, not binary.
 

Casper

ProgressTalk.com Moderator
Staff member
upload directory. Only text file upload is supported, not binary.

In more recent releases of Progress binary upload is supported too.

Casper.
 

gnome

Member
DEFINE VAR mFile AS memptr NO-UNDO.
DEFINE VAR cfile_dest AS memptr NO-UNDO.

ASSIGN mFile = get-binary-data("fileattached")
cfile_dest = get-config("fileUploadDirectory":U) + '\' + entry(num-entries(cfile),cfile,'\')

IF mFile <> ? THEN DO transaction: /*we got a valid pointer*/
{&out} '<div align=center id="infotitle">Sending attachment to Server...</div>'.

find first uploaded_file where uploaded_file.isr_no = get-value('record_key')
and uploaded_file.file_name = cfile
exclusive-lock no-error.

/*copy file to upload directory-configured in webspeed broker*/
COPY-LOB FROM mFile TO file cfile_dest NO-CONVERT no-error.

IF not avail uploaded_file THEN do:
create uploaded_file.
assign uploaded_file.isr_no = get-value('record_key')
uploaded_file.file_name = cfile
uploaded_file.gen_file_name = docprefix + string(next-value(next_document_no),'999999') + '.' + entry(2,cfile,'.')
no-error.
END.
/*copy file from upload directory-configured to field of record*/
COPY-LOB FROM file cfile_dest TO uploaded_file.file_obj NO-CONVERT no-error.
IF avail uploaded_file THEN do:
IF uploaded_file.file_obj = ? THEN
assign lfileOk = false.
end.
else
assign lfileOk = false.

if not lfileOk then do:
{&OUT} '<div align=center class="error_message">Error: Invalid Attachment! Please check your entry.<br /><br />'.
{&OUT} '<input type="button" id="logicalbutton" name="back" value="Back" onclick="history.back();" /> <input type="submit" id="logicalbutton" value="Cancel">'.
{&OUT} '</div>'.
end.
else do:
{&OUT} '<div align="center" id="infotitle">Attachment successfully uploaded!<br /><br />'.
{&OUT} '<input type="submit" name="Send" value="View Request List" onclick="action=' + "'" + 'requestlist' + "'" + ';" />'.
{&OUT} '</div>'.
assign lfileOk = false.
end.
end.

I'm uploading both text and binary files with this code
 
Top