Jump to content
Sign in to follow this  

Downloads in CWP

Recommended Posts

Just wondering if anyone has experience using $sc->download() in CWP/PHP. The documentation is sparse at best. I've been playing with this a bit, but haven't gotten it to work (trying to download an SC file to my local drive). I have the cURL library activated in PHP, so that should not be an issue. I think the main issue I have is trying to figure out what the proper syntax is for the destination. I tried what was in the example ('/tmp'), but got a permissions error. Ideally I'd like to have things go to the Downloads folder on the user's machine - has anybody done that?


More broadly, the ultimate goal is to allow users to select a set of images from a web page, and be able to zip them up and download them to the Downloads folder. I'm thinking that I would probably need to download the files into a temp directory on the server & then zip them & download them using php. Either that, or perhaps request some custom coding by the 360Works folks...


Any suggestions on how to approach all of this would be greatly appreciated.



Share this post

Link to post
Share on other sites

Hi Dave!


I have a web portal that I use to serve up "job site photos" to my vendor.  


My Filemaker Server is completely inside my firewall and the web application server "straddles" the firewall.   I use SuperContainer internally for all of my images.    As such, it works pretty easy to pull the SuperContainer managed images from the Filemaker Server to my (linux) web server.


I am doing something very similar to the following:

// Make sure that JPEGs have enough elbow room in memory when creating thumbnails


$IMAGECACHEDIR = "tempdl";  // This is top level where we will download supercontainer files

$SC_BASE_URL = 'http://myserveraddress.com/SuperContainer/Files';  // Base URL

// Full path to the images folder
$TEMPFILES = "/var/www/books/" . $IMAGECACHEDIR . "/";

$sc = new SuperContainer($SC_BASE_URL);   // Create a new SuperContainer object

$targetfile = "Books" . "/" . $BookRecord['bookID'][0];

// Ask for the file's info.
$targetinfo = $sc->getInfo($targetfile);

// Create an OS friendly file name of of it
$fileName = strtolower(str_replace(" ","",str_replace("r","",$targetinfo['name'])));

// I grab some of the file info which I use for display and such
$fileSize = $targetinfo['size'];
$uploadDate = $targetinfo['date'];

$at_container = $sc->download($targetfile,$TEMPFILES . $fileName);


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...

Important Information

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