{"id":1128,"date":"2008-07-09T03:45:24","date_gmt":"2008-07-09T08:45:24","guid":{"rendered":"http:\/\/www.mrc-productivity.com\/legacy\/?page_id=1128"},"modified":"2018-02-09T11:10:24","modified_gmt":"2018-02-09T17:10:24","slug":"upload-files-to-server-via-web-2-0-maintenance-applications","status":"publish","type":"page","link":"https:\/\/www.mrc-productivity.com\/legacy\/maint\/upload-files-to-server-via-web-2-0-maintenance-applications","title":{"rendered":"Upload Files to Server"},"content":{"rendered":"<p><!-- Begin Content --><\/p>\n<h1>Upload Files to Server<\/h1>\n<p>&nbsp;<\/p>\n<p>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.<\/p>\n<p>To begin, create a maintenance application as you normally would.  In &quot;Field Settings&quot;, find the field that will serve as the <strong>File Name<\/strong> for the uploaded file.  In the User Defined Field Control, select the &quot;U&quot;.  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.<\/p>\n<p><img decoding=\"async\" src=\"\/legacy\/images\/uploading1.jpg\" \/><\/p>\n<p>Build your application as you normally would.  Before running the application, let&#39;s look at the application properties for this program.  After you scroll to the bottom, you will see these three options:<\/p>\n<p><img decoding=\"async\" src=\"\/legacy\/images\/uploading2.jpg\" \/><\/p>\n<p>The &quot;upload_dir&quot; is the location on the <strong>server<\/strong> that this file will be uploaded to.  If the folder does not exist, it will be created.<\/p>\n<p><strong>Note:<\/strong> 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.<\/p>\n<p>The &quot;upload_max_size&quot; is 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.<\/p>\n<p>The &quot;upload_auto_rename&quot; allows you to control the behavior when a file of the same name already exists in the upload_dir.  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.<\/p>\n<p>Make any necessary changes and click &quot;OK&quot;.<\/p>\n<p>When I run my application, I see something like this:<\/p>\n<p><img decoding=\"async\" src=\"\/legacy\/images\/uploading3.jpg\" \/><\/p>\n<p>Notice the &quot;Browse&quot; button in the Attachment cell.  Clicking on &quot;Browse&quot; brings up a view of my local machine.  After I select a file, the location will be inserted.<\/p>\n<p><strong>Note:<\/strong> 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.<\/p>\n<p><strong>Error Checking<\/strong><\/p>\n<p>Below is a list of the common error checking that m-Power will do to ensure that the proper information is being uploaded:<\/p>\n<p>If the file name is too long, this error is displayed:<\/p>\n<p><img decoding=\"async\" src=\"\/legacy\/images\/uploading4.jpg\" \/><\/p>\n<p>If a file exceeds the maximum size, this error is displayed:<\/p>\n<p><img decoding=\"async\" src=\"\/legacy\/images\/uploading6.jpg\" \/><\/p>\n<p><strong>Editor&#39;s Note:<\/strong> The Maximum Size was changed in this example for practicality purposes. The default size is 100 MB.<\/p>\n<p>Standard maintenance rules apply: Key fields must be unique.  In addition, 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 &quot;Damaged_goods.jpg&quot; to a 15 alpha field, it would be rejected, as &quot;Damaged_goods.jpg&quot; is 17 characters long.<\/p>\n<p><!-- End Content --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Upload Files to Server &nbsp; 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. To begin, create a maintenance [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3567,"menu_order":5,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1128","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/pages\/1128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/comments?post=1128"}],"version-history":[{"count":12,"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/pages\/1128\/revisions"}],"predecessor-version":[{"id":8512,"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/pages\/1128\/revisions\/8512"}],"up":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/pages\/3567"}],"wp:attachment":[{"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/media?parent=1128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}