PxPlus User Forum

Twitter Twitter Twitter

Recent Posts

Pages: 1 ... 6 7 [8] 9 10
71
Programming / Re: creating UTF-8 text file
« Last post by Allen Miglore on March 10, 2024, 10:43:05 AM »
72
Programming / creating UTF-8 text file
« Last post by Alain Stucki on March 10, 2024, 05:19:57 AM »
Hello. I'm trying to get our product data into a CSV-file and use this to import our data into a webshop. So I OPEN LOCK (7)"datafile.csv" and then I PRINT the requried data into that csv-file.

That works fine. I can open the file with Windows Editor and everything looks good. But when I import the file into the webshop, the accented characters look weird.So the problem is the codepage . The shop requires UTF-8 file format. And the file my little program has created is ANSI. So my questions is: How can I create UTF-8 text files (no BOM) or would I need to use a CLI tool to convert the file from ANSI to UTF-8?

Best regards
Alain Stucki
73
iNomads / Re: File Upload
« Last post by Mike King on March 09, 2024, 02:00:30 PM »
My suggestion would be to upload to a temporary directory then check the file size and contents using a virus scan and only then copy it to the proper location.

Technically there is no 'sure fire' way to control what the user is uploading.  For example while you might want to restrict a user to only upload a JPG or PNG, they could simply rename a infected file to have a .png or .jpg suffix.  Only once the file is uploaded can you confirm its contents. 

For JPG, PNG and BMP files you can read the first few bytes of the uploaded file to confirm the file type, then run whatever anti-virus software you want on the file before accepting it.  For example if you use Avast as your anti-virus the command ashCmd.exe can be used to scan a specific file and report its findings.
74
iNomads / File Upload
« Last post by bteixeira on March 08, 2024, 04:57:18 PM »
Looking into allowing users to upload some files but worried that there seems little control.  Is there any way to limit the files a user can upload based on file type and/or size?  %inomads'upload_file doesn't seem to have any limitations.  I'm planning on saving the file to a directory and run a command line virus scan on it, but it would be better if I could do that on the web server and then move the approved file to the application server after it's been scanned.  Is there any way to put the upload file in the session's tmp directory or something?
Thanks.
75
Web Services / Re: Publishing a PDF through PXPlus web engine
« Last post by pwhirley on March 08, 2024, 08:27:01 AM »
Thanks Mike,
That's too easy.  :-)

The piece I was missing is the %Content-type$ global variable.  I'm sure there are many other variables used by the web engine that I don't know about.

I appreciate the help.

- Phil
76
Web Services / Re: Publishing a PDF through PXPlus web engine
« Last post by Mike King on March 07, 2024, 09:58:08 PM »
Here is a simple web program that will return a PDF file:

Code: [Select]
0010 OPEN (HFN)"*pdf*;file=output.pdf"
0020 FOR i=1 TO 20
0030 PRINT (LFO)"This is line ",i
0040 NEXT i
0050 CLOSE (LFO)
0060 OPEN (HFN,ISZ=-1)"output.pdf"
0070 READ RECORD (LFO,SIZ=1000000)contents$
0080 CLOSE (LFO)
0090 WRITE RECORD (%print_fn)contents$
0100 LET %Content_type$="Application/pdf"
0120 END

It creates a PDF file on "output.pdf" with lines 1 thru 20, sets the content type, and returns the PDF file contents.

You should be able to save this on your PxPlus Web server in the document root directory as something like pdf.pxp then call up the URL.  It will display the PDF.

Obviously in production you would dynamically create the PDF output file name and delete it when done.
77
Web Services / Re: Publishing a PDF through PXPlus web engine
« Last post by pwhirley on March 07, 2024, 06:21:11 PM »
Well, Mike.  I'm sure I'm doing something wrong.  I've tried using an HTML format with <head> and <body> putting the content-type: application/pdf and content-size in the <head> and the binary in the <body>.  I've also tried an HTTP POST format, which I've never used to send *to* a web browser.  Neither one worked. 

I've also tried using <embed>, <object> and <img> with encoding/decoding the pdf data.

What format should I be using?  I'm testing with just the web engine directly.  Eventually I'll probably be using IIS or Apache, but those aren't set up to use, yet.  I've never used the web engine except with iNOMADS, Webster+ and the old Sage 100 eBusiness stuff.

- Phil
78
Web Services / Re: Publishing a PDF through PXPlus web engine
« Last post by Mike King on March 06, 2024, 04:18:29 PM »
Let me know if you have any issue with setting the content type.  It should work.

As for me, while we have left PVX Plus Technologies, I am enjoying semi-retirement.  Doing some ad-hoc consulting in order to keep active and busy.

Anyway, if you need help feel free to contact me and we will see what we can do.
79
Web Services / Re: Publishing a PDF through PXPlus web engine
« Last post by pwhirley on March 06, 2024, 04:07:29 PM »
Thanks Mike,
I think that the application/pdf might well work.  I'm not sure why I didn't think of that.  It should work fine with the IIS front end, I believe.

I appreciate the quick response.  I hope you're enjoying retirement as much as I am.  :-)

Phil

Philip Whirley
phil@whirley.org
80
Web Services / Re: Publishing a PDF through PXPlus web engine
« Last post by Mike King on March 06, 2024, 03:18:05 PM »
Another thought, if the web server is Apache you might be able to use ProxyPass (and possibly ProxyPassReverse) to have the web simply re-route the specific request to your backend PVX Plus web server. 

This could be used to forward to whole request and return the result or to forward a request for the resultant PDF file and simply leave the PDF files on the PxPlus server.

There is something similar available for IIS if needed.
Pages: 1 ... 6 7 [8] 9 10