Upload Files to Server

Click here to access legacy documentation for this feature.


One feature of Maintainers is to allow the uploading of files from your client machine to the server. This feature is unique in the fact that it will also add a record to the database, as well as upload the specific file to the server.

Getting Started

To begin, create a maintenance application as you normally would. In “Field Settings”, change the dropdown box from “Basic field attributes” to “Form input attributes.”

Find the field that will serve as the File Name for the uploaded file. In the “User Def” column, select the “U”. This will tell m-Power to create an upload button next to this field and when the record is written to the table, write the File Name to this field.

App Properties

Before running the application, let’s look at the application properties for this program. After you scroll to the bottom, you will see these three options:

File Upload Directory — The location on the m-Power server where this file will be uploaded. If the folder does not exist, it will be created.

While you must pick a valid drive, this property supports two substitutions for dynamic uploading. First, you can use ${mpower} to automatically select the m-Power folder, which is useful for deployment between development and production. Second, you can use ${FIELD} where FIELD is the name of a field, which can be used to upload a file to a directory dependent upon some form value your end user selects.

File Upload Max Size — The maximum size, in megabytes, that a file can be in order to be uploaded. If a file is too large, the user will see an error at runtime that they must pick a smaller file.

File Upload Auto Rename — Allows you to control the behavior when a file of the same name already exists in the upload directory. You can either choose to have m-Power auto-rename the file (so file.txt would become file(1).txt) or you can automatically overwrite the existing file.

Make any necessary changes and click “OK”.

Runtime Usage

When I run my application, I see something like this:

Notice the “Browse” button in the Attachment cell. Clicking on “Browse” brings up a view of my local machine. After I select a file, the location will be inserted.

The upload feature is designed only to add files. This feature is not meant to remove files or modify files in any way, other than already discussed.

Error Checking

Below is a list of the common error checking that m-Power will do to ensure that the proper information is being uploaded:

If the file name is too long, this error is displayed:

If a file exceeds the maximum size, this error is displayed:

Editor’s Note: The Maximum Size was changed in this example for practicality purposes. The default size is 100 MB.

The number of characters in the file name can not exceed the length of the File Name field. For instance, if I want to upload the file “Damaged_goods.jpg” to a 15 alpha field, it would be rejected, as “Damaged_goods.jpg” is 17 characters long.

Updated on September 30, 2021

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support