CWP PHP Beginner Question: File Upload Methodologies

Discussion created by steve_ssh on Jan 26, 2014
Latest reply on Feb 1, 2014 by TimDietrich

Hello Everyone,



Background to this post:


I am beginning my studies of CWP with the FM PHP API, and right now I am at the level of a rank amatuer.


So far the resources that I am learning from are:


- The Formulations Pro book by Todd Duell

- The FMS12 CWP with PHP Guide by FMI

- Posts on this forum


The version of FMS that I am learning with is FMS 12; I'm using the development license key, and running my dev environment on an older version of OSX (10.6.8), as a single machine deployment.




Background to the question:


I note that in the CWP PHP API guide there is the following statement:


"When you publish a database using the Web Publishing Engine, the following limitations apply to container field objects: Web users cannot modify or add to the contents of container fields. Web users cannot use container fields to upload objects to the database."






Supposing I were to desire to allow users of a CWP/PHP web app to upload files to be stored in a container field in some FM table:


The options that I see are as follows:


1) Have the PHP script receive the uploaded file, scan it for appropriate size and content, and then relocate the file to a directory where FMS would have permissions to grab the file locally using the file:// protocol and the Insert From Url script step.


2) Have the PHP script receive the uploaded file, scan it for appropriate size and content, and then store the file somewhere where the webserver could serve the file to FMS, and FMS would access the file using http:// or https:// protocol and the Insert From Url script step. (I'm not fond of this option, as it opens a security concern of making sure that only FMS will be served the file, but I'm thinking that perhaps someone has done this in the case of a deployment where the webserver is on a separate machine, and the FMS server is locked down, i.e. no access via something like scp.)


3) Change my mind, and not store the content within a container field, and instead utilize something like SuperContainer.




Am I thinking about this sensibly and accurately, or are there other parts of the picture that I am not seeing?


Note that this is not for a practical application as much as it is for me to learn the lay of the land and find out what the common practices are in this territory which is new to me. As such, I don't have any theoretical values to toss out for how much data would need to be stored. Mostly I would like to check in with the CWP pros on the forum and find out if I am thinking along the lines of standard practice, or if I am completely not getting it, and if the latter, what topics I should be looking into regarding this particular topic.


Any comments from those willing to share their experience would be much appreciated.


Many thanks and best regards,




p.s. By and large, the world of CWP and PHP looks like it will be an enjoyable environment to work within. Thanks for helping me get off to a good start!