Note that the "File" field is an externally stored container.
And is secure or open storage specified for that container field?
It's an open storage container.
Please note that I have not worked with PHP and thus am looking at this strictly from the FileMaker side of the fence. Thus, I could very, very easily be wrong here, but...
The data inside a container field can be very different depending on the insertion method used to insert the file. Files inserted into a container field with the "store a reference" option enabled insert a file path to the file. Files inserted without this option do not and a physical copy of the file is embedded in the field.
"external storage" container fields are not intended for use with "by reference" insertion options. The file is embedded into the container field and then FileMaker copies the file to the specified external storage location.
Thus, I am wondering if this PHP function might only work when the file is inserted "by reference". If so, then there is no "URL" for the function to produce as there is no file path in the container field to use to produce that URL.
The files that the container manages are not inserted by reference (that option is scripted out so it's not possible). According to the 2012 DevCon CWP session (INT002, 55:00 in), the URL returned using getContainerURL with a regular container reads like this:
And enhanced containers should have URLs that look like this:
My URL being returned looks like this:
That tells me that the method is returning a regular container, and not the enhanced container URL. Hope this is helpful to getting a solution.
Yes, but what do you get if you try this with a container field that has a file inserted with "store a reference" enabled? Do you get a different result?
"Enhanced" is not a term used when specifying options for a container field. I'd guess that "enhanced" refers to a field that has been "optimized for interactive content". And that is a different property than whether or not the file has been inserted "by reference".
I have tried inserting a reference file, and that doesn't work. It brings up an error that the file cannot be found. That's because the FileMaker isn't uploading the file to my server, rather just leaving it where it is on my computer.
That makes sense and suggests that you have uncovered a bug, but a FileMaker tech will need to confirm that.
Tim over on TechNet was able to help me get a workaround going. I had to create a separate php file and use curl to login to the server and grab the file.