4 Replies Latest reply on Oct 15, 2014 2:47 AM by RugenHeidbuchel

    PHP getContainerData() does not support remote containers ????

    RugenHeidbuchel

      Title

      PHP getContainerData() does not support remote containers ????

      Your post

           I'm trying to display the image from a container field using the php API, every time I try accessing the data, I get the following error:

      getContainerData() does not support remote containers

           Here's the code I use:

           
                foreach ($records as $imageRecord) {
           
                 
           
                $url = urlencode($imageRecord->getField('Image'));
           
                echo '<img src="containerBridge.php?path=' . $url . '">';
           
                }

           The containerBridge.php file looks like this:

           
                <?php
           
                include("dbaccess.php");
           
                 
           
                if (isset($_GET["path"])) {
           
                 
           
                $url = $_GET["path"];
           
                $url = substr($url, 0, strpos($url, "?"));
           
                $url = substr($url, strpos($url, ".") + 1);
           
                 
           
                if ($url == "jpg") {
           
                header('Content-type: image/jpeg');
           
                } elseif ($url == "gif") {
           
                header('Content-type: image/gif');
           
                } else {
           
                header('Content-type: application/octet-stream');
           
                }
           
                 
           
                echo $fm->getContainerData($_GET["path"]);
           
                }
           
                ?>

           I tried searching the internet for answers, but there's no info at all! I hope someone can help me...!

           Thanks in advance,
           Rugen Heidbuchel

        • 1. Re: PHP getContainerData() does not support remote containers ????
          kiwikaty

          Hi, I am having the same issue. Did you ever solve this please?

          • 2. Re: PHP getContainerData() does not support remote containers ????
            RugenHeidbuchel

            Yes, FileMaker 12 and 13 no longer support this functionality. I changed my applications to store the files somewhere on my server and just store the URL or relative URL in FileMaker. You can then show the image in FileMaker using a web view.

            Perhaps there are workarounds to provide this functionality with container views, but I never found out how...

            I hope this helps you out! Feel free to reply...

            Greetings,
            Rugen Heidbuchel

             

             

             

             

            • 3. Re: PHP getContainerData() does not support remote containers ????
              ktbutter

              Hi Rugen

              I see your issue was with pictures not pdfs so not quite the same issue but the same php message on fail which is what brought me to your post.

              I have posted what I found but of course this is only relevant to what I was trying to achieve which was showing download links for related pdfs stored in the db…

              I have a very similar container(bridge) file except I have added in mime for pdf. I was getting " getContainerData() does not support remote containers” error when trying to see related pdfs that are stored in another database. In the end the message was a bit misleading and I found a reference to setting the security settings of the related file on another post. I had the same username and pw in both files with php access but when I revisited the settings discovered I had not given the priv set access to the correct layout in the related file. i.e not the layout where I had placed the container field! Once I made sure I had the portal on the web layout of the course file and the right permissions to the layout in the related file which had the container on it the error went away and I could see and download the related pdfs stored in the other file.

              I have not included the code that sits above this that gets data from file A but I have included what I am using to see the related pdfs in file B. I am not sure if my test for related pdfs is a very sound one as I am a php novice but it seems to work.

              <!--Now show related Records    -->
              <?php
              $pdfs = $found_records_row->getRelatedSet('DR01_PDFs'); ?>

              <!—Only show if there are related pdfs    -->
              <?php
              If (is_array($pdfs) !== False) { ?>

              <h4>Course Booklet/s</h4>
                      
              <table cellpadding="0" cellspacing="0">
              <?php
              foreach($pdfs as $key) { ?>                          
              <tr>
              <td>
              <?php $name = $key->getField('DR01_PDFs::PDF Name'); ?>  
              <?php $path = urlencode($key->getField('DR01_PDFs::PDF')); ?>
              <?php echo ('<a href="container.php?-path='.$path.'" target="_blank">'.$name.'</a>'); ?>
              </td>
              </tr>
              <?php } ?>
              </table>

              <?php } ?>

              Thank you for taking the time to reply Rugen.

               

              • 4. Re: PHP getContainerData() does not support remote containers ????
                RugenHeidbuchel

                Hi

                It's a very good sign that you managed to get this working. When I have the time, I'll try to implement this functionality in my database with images. If it works, that would make my application structure a whole lot easier and safer.

                Thanks for sharing your findings with me and good luck for the rest of your project!

                Greetings
                Rugen Heidbuchel