How to upload file?

i wish to upload file to web server for further processing. how do i do it in natural? i have included a sample asp file for reference. pls help.

thanks in advance.

[color=“blue”]

File Upload

File: [/color]

:cry: Works not with SYSWEB, because SYSWEB can only transfer alphanumeric data and will
block CONTENT-TYPES like ‘multipart/form-data’.

:lol: Works with SYSWEB3.
You can find a delivered example at the SYSWEB3 Libray:
E3MULTIP.

Don’t forget to install the new Web Interface version with
nww3* programs at your http server side, a
different RPC/DCOM server with steplib to SYSWEB3 and
then run the program from your browser.

Note:
The program does NOT show to seperate the different “multipart” sections.

thanks for info. need to research. will let u know of result.

eric, i have a problem when migrating my programs from SYSWEB to SYSWEB3. I have followed the migration steps mentioned in Natural documentation. Programs that can be run previously in SYSWEB now can’t run anymore, and it generates this error:

“The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:”

What could be the reason? Thanks in advance!

joel

To migrate your programs it is only necessary to recatalog with steplib SYSWEB3 instead of SYSWEB (can be reversed, if you don’t use new features).

Then you have to call e.g. nww3cgi.exe or nww3dcgi.exe otherwise you get a parameter problem.

You need to change your RPC server (don’t forget security if used) that there is a steplib to SYSWEB3 not to SYSWEB and not to both.

If you use DCOM don’t forget to register your class SYSWEB3 and to change the parameter module used for the DCOM server.

Check a delivered program from SYSWEB3, e.g. NAT-ENV, to check that your installation works in a correct way.

If you run //nww3cgi.exe/SYSWEB3/NAT-DIR?LIB=, there is a new functionality, where your can see what interface your program is cataloged with.

thanks for the fast reply. here is what i have done:

  1. recatalog with steplib SYSWEB3 instead of SYSWEB
    yes. i have removed SYSWEB from steplib in NATPARM and included SYSWEB3

  2. you have to call e.g. nww3cgi.exe or nww3dcgi.exe
    yes. i have changed from nwwdcgi.exe to nww3dcgi.exe respectively

  3. If you use DCOM don’t forget to register your class SYSWEB3 and to change the parameter module used for the DCOM server
    yes. i have registered my class SYSWEB3. how to change parameter module? is it related to “nww3dmod.ini” or “nww3dmod2.ini”?

  4. Check a delivered program from SYSWEB3, e.g. NAT-ENV
    below is the result:
    [color=“green”]Environment Variables
    Name Value Length From
    PATH_INFO SYSWEB3/NAT-ENV 15 Server
    NATWEB_VERSION 06.02.01 WEB-ONL 16 Server
    NATWEB_LOGTIME Tue, 26 Sep 2006 14:30:24 GMT 29 Server
    NWW_INOUT_LENGTH (A) DYNAMIC 11 Server
    SCRIPT_NAME Test/Utility3/ 14 Server
    GATEWAY_INTERFACE HTM-ONL/GUI/06.02.01 20 Server
    REMOTE_HOST localhost 9 Server
    REMOTE_ADDR 127.0.0.0 9 Server
    SERVER_SOFTWARE Natural Test Utility 20 Server
    HTTP_USER_AGENT Natural 7 Server
    SERVER_NAME localhost 9 Server
    SERVER_PORT 80 2 Server
    NWW_USER_ID JOEL HWA 8 Server
    DCOM_SERVER_NAME (local dynamic) 15 Server
    REQUEST_METHOD GET 3 Server

NAT-ENV - Tue, 26 Sep 2006 14:30:24 GMT 15 variables Natural [/color]

  1. If you run //nww3cgi.exe/SYSWEB3/NAT-DIR?LIB=, there is a new functionality, where your can see what interface your program is cataloged with.
    I dont understand this statement.

Looking forward to your reply soon. Thanks.

-joel

ok eric. i understand te last statement. hehe…it’s a cool utility!!!

unfortunately, it still gives the CGI Error. :frowning:

You did already what you needed. nww3dmod2.ini is if you use Apache modules instead of cgi.

Question:
Did you previous run your DCOM Server with NAT61?
If that’s the case, you have to unregister your class and then register your class again with your NAT62 environment.
→ during registration the path to the DCOM server (in this case Natrural) is saved at the registry.

Hint:
Did you ever run NAT-DOCU - there you can see more useful NAT-* utilities …

hmmm…eric…currently i’m using NAT6.1 :shock:

already requested from SAG for Nat6.2 but the cds have not arrived.

so how to solve my problem? :lol:

i will try the NAT-DOCU. Thanks

eric sorry sorry!

just checked again. i’m currently using NAT6.2.1 and not NAT6.1 now waiting for Nat6.2.2 :oops:

i have tried that option also. unregister,delete class and LWEB, and then generate a new class again after i have cataloged the whole library.

need advice…

:idea: DCOM Server …

… for SYSWEB3 you need a ‘different’ class with different internal interfaced - I forgot :roll:
… unregister your user defined class
… delete you user defined class for your library. Don’t forget do delete the spcific LDA for this library.
… run the Web Interface Plugin and generate a “new” class and lda for your Library.
… register your class
… and try again

I have tried that eric, i unregister,delete both the class and LWEB, then i regen again using the Web Interface Plugin, before i post my question.

the only thing i din try before your first advice was to register SYSWEB3 class. :lol:

What http server do you use?
The examples (e3*) form SYSWEB3 work?
Did you try a new generated program from the Web Interface plug-in and run this successfully?
Do you old programs call PERFORM W3CONTENT-TYPE ?

How does the url you call from the browser look like?
… calling SYSWEB3 subprograms
… calling your own subprograms
because your tried NAT-ENV from WEB-ONL3, not from your browser:
SCRIPT_NAME: Test/Utility3/
GATEWAY_INTERFACE: HTM-ONL/GUI/06.02.01

Actually Eric, some of my subprograms are working and some are not. Based on my guess, below is part of my code that i think gives the error (i’m using a dispatcher program just exactly like in the sample):

[color=“green”]
VALUE “MY PROFILE”
PERFORM SR-2VUSR #PARM-WEB

VALUE “UPDATE”
PERFORM READ-ENV
CALLNAT “SP-GUSR” #USERID #USERNAME #PASSWORD #USERTYPE
#COMPANYCODE #REPORT(*)
CALLNAT “SP-2SUSR” #USERID #PASSWORD #OLD-PASSWORD
#NEW-PASSWORD1 #NEW-PASSWORD2 #PARM-WEB.#MSG
PERFORM SR-2VUSR #PARM-WEB[/color]

When i click on “My profile” which is a form button at menu page, i can get to the view page (SR-2VUSR). However, when i click on “Update” button at the view page, it will then generate the CGI Error. It seemed that[color=“red”] I can’t call back the same subroutine /color.

I don’t have this problem when my program was catalogued with SYSWEB. But since migrating to SYSWEB3, I have this recurring problem. Need to solve it fast cause i’m in a tight project deadline.

Thanks in advance.

Eric, found out the root of the problem already, but unfortunately still no solution. This is the report generated after i have excluded W3INIT and W3END on purpose:

[color=“red”]The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

ID=4&USER-ID=5&USERNAME=&PASSWORD=&USER_TYPE=Choose User Type:&TODO=Main Men[/color]

As you can see from the TODO paramater, the last byte of the string is truncated. Therefore, my dispatcher can’t match the string hence cause the error. If i change my dispatcher to accept “Main Men” then the application can work just fine.

Again, i wish to emphasize that i do not face this problem with SYSWEB. So need your advice.

-joel

Question:
Did you get this string using again web-onl3 or from the browser?
How does the calling page/link look like?

Call you call instead of your program NAT-DATA and see what data has been delivered from the HTTP server.

i call from my browser and NOT from web-onl3.

this is from edit new user page (SR-3NUSR)
http://localhost/cgi-bin/nww3dcgi.exe/WEB/SELECT?ID=4&TODO=New+User

this is after i click “Save New User”
http://localhost/cgi-bin/nww3dcgi.exe/WEB/SELECT

then the error occur…this is the string if i exclude W3INIT and W3END:
ID=4&USER-ID=5&USERNAME=a&PASSWORD=a&USER_TYPE=C&COMPANY=STB&CBREPORT=1&TODO=Save New Use

again the last byte is truncated. that is the source of the problem. but i can’t seem to solve it.

btw, eric, does the character encoding affect the truncation of string???