Jump to content

Download Container Data via PHP to local Server


This topic is 2655 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi,

we are using a little sync script via php, which allows us to store all data from a FileMaker DB into our internal MySQL-Database. 
The only problem iam unable to solve is how to download images from container fields and store them local on our web server. 

I tried something like:
 

foreach($recordsPersons as $recordPersonsData) {

          //saving images to /srv/www/htdocs/
          $url_orig = urlencode($recordPersonsData->getField('FotoDatei'));

          // Search for the extension of the file 
          $url = substr($url_orig, 0, strpos($url_orig, "?")); 
          $url = substr($url_orig, strrpos($url_orig, ".") + 1); 

          // Send the correct Content-Type header 
          if($url == "jpg"){ 
              header('Content-type: image/jpeg'); 
          } else if($url == "gif"){ 
              header('Content-type: image/gif'); 
          } else{ 
              header('Content-type: application/octet-stream'); 
          } 

          // save file local.
          file_put_contents('/srv/www/htdocs/testfilepicture.jpg', $fm->getContainerData($url_orig));
}

I was using this reference: http://blog.myfmbutler.com/?p=104

This Code-Snipped works well, but only writes "getContainerData() does not support remote containers" into testfilepicture.jpg..

We are using FileMaker Server 14.

Any Ideas?

Thanks in advance and Cheers

Edited by Marcwa19197
Link to comment
Share on other sites

This topic is 2655 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.