Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problem with Downloads using the PHP API

Featured Replies

I've been making a website for the past few days and have recently run into a problem while trying to make files from a container field download with a specific name.ext. I've been using a modified version of the image bridge like I've seen others do that they say has worked.


//the path is the standard urlencode(getfield)

//typical database connection info here



$dl = $fm->getContainerData($_GET('path'));

header('Content-type: application/force-download; name="p.pdf"');

header("Content-Disposition: attachment; name="p.pdf"');

echo($dl);

What I get is a download that has the name p.pdf but when it finishes downloading it is unable to be opened by anything. I've tried removing the content-disposition and it downloads a file with the same name as my php bridge and if i rename it it opens perfectly fine as a pdf. I'm really lost as to why it's doing what it's doing.

If anyone has any input as to where to go from here I'd be very appreciative.

Other Info

I've seen where filemaker gives 3 options in the path URL:

1 data.jpg

2 data.gif

3 data.con

in order to determine what is in the container. mine always come out to jpg.

  • 2 weeks later...
  • Author

I found out was was wrong with the download and why it wouldn't work.

A.) I was storing a reference instead of the actual file(read the php doc from filemaker and they say it's a no no).

B.) I was storing PDF's as an image for viewing in the database using a filemaker client and that is also unacceptable.

So i fixed those 2 problems and I was able to use the modified bridge with Content-Disposition to force a download of a PDF.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.