PxPlus User Forum

Main Board => Discussions => Web Services => Topic started by: martinp on March 26, 2022, 05:28:17 PM

Title: Pvxweb File Upload
Post by: martinp on March 26, 2022, 05:28:17 PM
Is there a way to receive a file with the pvxweb server?  (Web browser uploads file to pvxweb serevr)

I was able to do it by using apache and PHP, but I was curious if I can handle the POST of the binary file through the pvxweb server alone?

Thanks.
Title: Re: Pvxweb File Upload
Post by: Mike King on March 27, 2022, 12:13:57 AM
Sure, although using the PxPlus Apache or EzWeb server makes it a little easier.

With the PvxWeb server you have to parse the data out of the body received, whereas the PxPlus Apache or EzWeb provide the file contents directly. 

Also Webster+ has an [upload] short code that makes file uploads even easier. Our Webster+ demo system actually shows doing this for images and data file downloads and uploads. 

Basically when using Webster+ the system automatically places the uploaded file contents in a temporary file for you so all you need to do is rename/copy that file. 

For example (from the demo site)

[upload imagefile$ size=20/4.5  event=uploader@product]Click or drag new image here to change[/upload][/color]

This short code will provide a file upload region that when clicked or has a file dropped on it, will place the file contents in a temporary file, puts that file name in the variable imagefile$, then fires the event "uploader@product" (i.e. run uploader passing it event "product").
Title: Re: Pvxweb File Upload
Post by: martinp on March 29, 2022, 10:43:44 AM
Thanks for the ideas Mike!  Perfect.

Martin