FileUpload

(:input file upfile size=60:) can be used for uploading (attaching) files. upfile in this example is the name of the control. One or several (with different names) can be used inside a fox form, in addition to other input controls. Fox will do the usual posting plus the file upload on form submission. In the (:fox formname ...:) markup either upload=1 or uptarget=TargetPageName needs to be set.

  • upload=1 will direct upload attached to current page or target page set with target=PageName.
  • uptarget=TargetPageName will attach upload file(s) to the page specified. Only one upload target can be specified.

To optionally rename the file use a text input box like (:input text upfile_name :) for instance. Note that it's upfile_name corresponds to the input file box name of upfile, the new name box needs to use the file box name with an added _name postfix.

The following replacement variables can be used in the template to post file attributes file name, file extension, file type and file size, or to use for input validation in (:foxcheck ...:) markup. upfile is the name of the input file control, i.e (:input file upfile:). Change it for different file controls.

  • {$$upfile_name} holds the file name.
  • {$$upfile_ext} holds the file extension.
  • {$$upfile_type} holds the file type.
  • {$$upfile_size} holds the filesize in bytes.

Upload Security: In order to successfully upload files the user needs PmWiki upload authorisation. $FoxAuth is not used.