Using File Uploads with Coyote

PicLan-IP version 2.0.0.158 has new logic built in that allow for easy integration of file uploads using the <input type="file" ...> HTML form tag.

How to setup the HTML document

In order to use file uploads, you will need to setup an HTML page that posts to Coyote with the following setup:

<form method="post" action="page_to_post_to.htm" enctype="multipart/form-data">
...
<input type="file" name="field_name">
...
</form>

This type of form encoding will allow a browser user to submit local files to Coyote.

How to process the page in BASIC

Once Coyote receives the page request, you can access the posted file with the statements:

PL_GETVAR FILE.NAME FROM '$1_NAME' ELSE FILE.NAME = ''
PL_GETVAR FILE.DATA FROM '$1_DATA' ELSE FILE.DATA = ''

The FILE.NAME variable will contain a string containing the HTML field name, followed by a space, followed by the name of the submitted file.

The FILE.DATA variable will contain the actual, unedited, contents of the file.

If the file is a text file, you will see CRLFs between file lines. Coyote does not automatically convert these to attribute marks.

If you upload a binary file, Coyote may not be able to accept all character encodings because of limitations in BASIC. In particular, most versions of BASIC cannot process CHAR(255) (segment marks).