Jump to content

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

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.

 

Dave

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
ini_set("memory_limit","50M");

require_once("supercontainer.php");

$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);

?>

Link to post
Share on other sites

This topic is 2059 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
  • Who Viewed the Topic

    1 member has viewed this topic:
    travstravz 

×
×
  • Create New...

Important Information

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