# How to us the NJXFILEUPLOAD2-control?

**URL:** <https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, NaturalONE, Natural-for-AJAX\
**Created:** [January 5, 2015, 4:19pm UTC](https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957 "2015-01-05T16:19:37Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hermann\_Platzer](https://avatars.discourse-cdn.com/v4/letter/h/a8b319/32.png) [@Hermann\_Platzer](https://techcommunity.softwareag.com/u/Hermann_Platzer)\
**Post date:** [January 5, 2015, 4:19pm UTC](https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957/1 "2015-01-05T16:19:37Z")

</div>

Hi,  
I am new to Ajax for Natural and tried some things out.  
What I am now working on is to upload TXT-files to ADABAS/Natural-Mainframe using the NJXFILEUPLOAD2-control

my problem is that it seems that XCIOBJECT.CONTENT is empty after upload - I checked this in the event “onUploadFinished”.

Is there to do anything else then press the upload button?  
documentation says that the content should then be available in XCIOBJECT.CONTENT.  
I want to display the content in a TEXT-control but there seems to be no content.

Or should I better use another control?

Thanks for your support!  
Hermann

---

<div class="post-metadata">

**Author:** ![Christine\_Zimmermann](https://avatars.discourse-cdn.com/v4/letter/c/839c29/32.png) [@Christine\_Zimmermann](https://techcommunity.softwareag.com/u/Christine_Zimmermann)\
**Post date:** [January 5, 2015, 11:47pm UTC](https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957/2 "2015-01-05T23:47:50Z")

</div>

Hi Herman,

did you have a look at the sample FILEUD-P in the njxdemos?

Best Regards,  
Christine

---

<div class="post-metadata">

**Author:** ![Hermann\_Platzer](https://avatars.discourse-cdn.com/v4/letter/h/a8b319/32.png) [@Hermann\_Platzer](https://techcommunity.softwareag.com/u/Hermann_Platzer)\
**Post date:** [January 7, 2015, 9:03am UTC](https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957/3 "2015-01-07T09:03:12Z")

</div>

Hi Christine,

yes - I had a look at the example - but there is only written

VALUE U’myupload.onUploadFinished’  
0500 /\* Now you can access the file content in the  
0510 /\* XCIOBJECTS data structure and store it for  
0520 /\* instance in a database.

But the XCIOBJECTS.CONTENT(\*) is empty in my case - so I am not sure what is the problem.

So the example is a combined one for up- and download - it’s not clear for me which parts are necessary for upload and which belong to download only  
e.g. at the begin of the example there are some CALLNAT’s

CALLNAT “LOADFILE” ‘njx\_buttonitemlist.pdf’ DOC1  
CALLNAT “MAKEURL” XCIOBJECTS(\*) DOC1 URL1 ‘njx\_buttonitemlist.pdf’

I suppose that they are only necessary for download and not for upload - or is this wrong?

Best regards,  
Hermann

---

<div class="post-metadata">

**Author:** ![Thomas\_Schwade](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/thomas_schwade/32/131_2.png) [@Thomas\_Schwade](https://techcommunity.softwareag.com/u/Thomas_Schwade)\
**Post date:** [January 7, 2015, 10:14am UTC](https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957/4 "2015-01-07T10:14:36Z")

</div>

> [@Hermann Platzer](#):
>
> CALLNAT “LOADFILE” ‘njx\_buttonitemlist.pdf’ DOC1  
> CALLNAT “MAKEURL” XCIOBJECTS(\*) DOC1 URL1 ‘njx\_buttonitemlist.pdf’

Yes, right, that part is only for the download.

Did you test with the original example FILEUD-P?  
Could you just enter the lines  
PRINT XCIOBJECTS(1)  
NEWPAGE  
into the event handler myupload.onUploadFinished and verify the content this way?

---

<div class="post-metadata">

**Author:** ![Hermann\_Platzer](https://avatars.discourse-cdn.com/v4/letter/h/a8b319/32.png) [@Hermann\_Platzer](https://techcommunity.softwareag.com/u/Hermann_Platzer)\
**Post date:** [January 7, 2015, 1:56pm UTC](https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957/5 "2015-01-07T13:56:50Z")

</div>

This is the result of PRINT XCIOBJECTS(1)

147194q.txt application/txt

This seems to be the CONTENTID and CONTENTTYPE of XCIOBJECTS - but CONTENT is still empty, isn’t it?

When I run FILEUD-P the CONTENT is filled - but I see no difference to my program  
and if the CALLNAT’s (LOADFILE, MAKEURL) are deactivated it also don’t work in FILEUD-P  
so the CALLNATs are not only for the download :!: :?: :!:

Here is my program:  
0050 DEFINE DATA LOCAL  
0060 1 NJX\_FILECONTENT  
0070 2 CEXT (A) DYNAMIC  
0080 2 CNAME (A) DYNAMIC  
0090 2 CONTENTID (A) DYNAMIC  
0100 2 CPATH (A) DYNAMIC  
0110 1 NJX\_KDKURZ (A) DYNAMIC  
0120 1 NJX\_TXTANZEIGE (A) DYNAMIC  
0130 1 NJX\_TXTKUVERTANSCHRIFT (A) DYNAMIC  
0140 1 XCIOBJECTS (1:_)  
0150 2 CONTENT (B) DYNAMIC  
0160 2 CONTENTID (A) DYNAMIC  
0170 2 CONTENTTYPE (A) DYNAMIC  
0180 \*  
0190 LOCAL  
0440 1 BLOB (B) DYNAMIC  
0450 1 URL (A) DYNAMIC  
0460 \*  
0470 END-DEFINE  
0480 \*  
0590 CALLNAT “LOADFILE” ‘njx\_upload.txt’ BLOB  
0600 CALLNAT “MAKEURL” XCIOBJECTS(_) BLOB URL ‘njx\_upload.txt’  
0610 \*  
0620 RESET BLOB  
0630 \*  
0640 PROCESS PAGE USING “PLIMPORT”  
0650 \*  
0660 DECIDE ON FIRST _PAGE-EVENT  
0670 VALUE U’nat:page.end’, U’nat:browser.end’  
0680 /_ Page closed.  
0690 IGNORE  
0700 VALUE U’btnKdSelektion’  
0710 /\* TODO: Implement event code.  
0720 PROCESS PAGE UPDATE FULL  
0730 VALUE U’njx\_FileContent.onUploadFinished’  
0760 PRINT XCIOBJECTS(1)  
0770 NEWPAGE  
0780 \*  
0960 PROCESS PAGE UPDATE FULL  
0970 VALUE U’onBtnAbbrechen’  
0980 ESCAPE MODULE  
0990 VALUE U’onBtnImportieren’  
1000 /\* TODO: Implement event code.  
1010 PROCESS PAGE UPDATE FULL  
1020 NONE VALUE  
1030 /\* Unhandled events.  
1040 PROCESS PAGE UPDATE  
1050 END-DECIDE  
1060 \*  
1070 END

I copied the subprograms MAKEURL and LOADFILE from SYSEXNJX to my library - but still not working.

BR,  
Hermann

---

<div class="post-metadata">

**Author:** ![Thomas\_Schwade](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/thomas_schwade/32/131_2.png) [@Thomas\_Schwade](https://techcommunity.softwareag.com/u/Thomas_Schwade)\
**Post date:** [January 8, 2015, 11:16am UTC](https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957/6 "2015-01-08T11:16:38Z")

</div>

I am attaching a minimal example for the upload, maybe you could check this out?  
Kind regards, Thomas  
[upload.zip](https://techcommunity.softwareag.com/uploads/short-url/7EpZESVrM7FnH1qJe7HMJHGO85K.zip) (4.69 KB)

---

<div class="post-metadata">

**Author:** ![Hermann\_Platzer](https://avatars.discourse-cdn.com/v4/letter/h/a8b319/32.png) [@Hermann\_Platzer](https://techcommunity.softwareag.com/u/Hermann_Platzer)\
**Post date:** [January 8, 2015, 12:35pm UTC](https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957/7 "2015-01-08T12:35:45Z")

</div>

Hi Thomas,

same result as in my previous example:

147194q.txt application/txt

no CONTENT, just CONTENTID and CONTENTTYPE

Best regards,  
Hermann

---

<div class="post-metadata">

**Author:** ![Thomas\_Schwade](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/thomas_schwade/32/131_2.png) [@Thomas\_Schwade](https://techcommunity.softwareag.com/u/Thomas_Schwade)\
**Post date:** [January 8, 2015, 2:05pm UTC](https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957/8 "2015-01-08T14:05:15Z")

</div>

Hermann,

sorry for that. If this small example does not deliver the content, I can only recommend to go for a support request. It could turn out to be a platform or version issue.

Kind regards, Thomas

---

<div class="post-metadata">

**Author:** ![Robert\_Neale](https://avatars.discourse-cdn.com/v4/letter/r/ad7895/32.png) [@Robert\_Neale](https://techcommunity.softwareag.com/u/Robert_Neale)\
**Post date:** [March 19, 2015, 10:07am UTC](https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957/9 "2015-03-19T10:07:27Z")

</div>

See zap NA95003.

---

<div class="post-metadata">

**Author:** ![Hermann\_Platzer](https://avatars.discourse-cdn.com/v4/letter/h/a8b319/32.png) [@Hermann\_Platzer](https://techcommunity.softwareag.com/u/Hermann_Platzer)\
**Post date:** [June 12, 2015, 11:04am UTC](https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957/10 "2015-06-12T11:04:20Z")

</div>

Hi,

we installed the zap and it works now 🙂  
content is filled - which brings me to my next question

I uploaded a txt-file and want to analyze its content - how to do this?  
I have to read line by line and do some actions

thanks and best regards,  
Hermann

---

<div class="post-metadata">

**Author:** ![Thomas\_Schwade](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/thomas_schwade/32/131_2.png) [@Thomas\_Schwade](https://techcommunity.softwareag.com/u/Thomas_Schwade)\
**Post date:** [June 12, 2015, 1:20pm UTC](https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957/11 "2015-06-12T13:20:52Z")

</div>

The uploaded file comes in form of a blob. If you know that it is a text file, you can move it into a text string, separate this into lines and work on the lines. Please see the attached working example.  
Best regards, Thomas  
[upload2.zip](https://techcommunity.softwareag.com/uploads/short-url/sqCECy280I0Ts3VZuAV7qrphN9C.zip) (4.97 KB)

---

<div class="post-metadata">

**Author:** ![Hermann\_Platzer](https://avatars.discourse-cdn.com/v4/letter/h/a8b319/32.png) [@Hermann\_Platzer](https://techcommunity.softwareag.com/u/Hermann_Platzer)\
**Post date:** [June 12, 2015, 3:16pm UTC](https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957/12 "2015-06-12T15:16:14Z")

</div>

Unfortunately it doesn’t work 😢

see attachment - encoding seems to have a problem …

BR,  
Hermann

 ![2015-06-12_1518.png](https://global.discourse-cdn.com/techcommunity/original/2X/4/4c3ea187f3748ebc16cd5ab91ed7157832190cb0.png)

---

<div class="post-metadata">

**Author:** ![Thomas\_Schwade](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/thomas_schwade/32/131_2.png) [@Thomas\_Schwade](https://techcommunity.softwareag.com/u/Thomas_Schwade)\
**Post date:** [June 15, 2015, 9:54am UTC](https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957/13 "2015-06-15T09:54:57Z")

</div>

I see: The example works for Unicode data, but I assume you have codepage ISO-8859-1 on the client (which corresponds to CP819 on the host) and an EBCDIC codepage on the host. And I assume we are receiving the data on the host in the client codepage ISO-8859-1 (CP819). So we have to convert it to the host codepage first. I don’t have a mainframe at hand, but the attached example should do it. If not, could you please tell which codepages are active on client and host (system variable \*CODEPAGE) and/or provide an example file? Thanks, best regards, Thomas  
[upload3.zip](https://techcommunity.softwareag.com/uploads/short-url/mUD3Ds5bmfeM4UcxCjxOiVH9Bam.zip) (5.1 KB)

---

<div class="post-metadata">

**Author:** ![Hermann\_Platzer](https://avatars.discourse-cdn.com/v4/letter/h/a8b319/32.png) [@Hermann\_Platzer](https://techcommunity.softwareag.com/u/Hermann_Platzer)\
**Post date:** [June 15, 2015, 4:15pm UTC](https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957/14 "2015-06-15T16:15:46Z")

</div>

is working 😃

just for info: \*Codepage delivers: IBM01141

Many thanks and best regards,  
Hermann

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:32pm UTC](https://techcommunity.softwareag.com/t/how-to-us-the-njxfileupload2-control/179957/15 "2021-04-02T15:32:38Z")

</div>


