Hi Developers: I have worked extensively with ASP and SQL, but am a php newbie. I recently started a new job and some of the sites I inherited are php. Okay now to my question. I have a site that does a good job of pulling images discretely so that it is very hard for anyone to see where they are on the server. It uses a "getimage.exe" file with query strings so that you can view the image (or pdf, or doc, or whatever the file may be, and it could be a multitude of types). However, it makes it difficult if someone wants to save it, so my assignment was to have an option to save the image in the tool bar in a zip file. I have worked out the zip part of it, but the problem is that I can't get the image to save to a directory. I can't edit getimage.exe and am getting an error using the query string results. I understand that the query strings are throwing the error, but I am not sure what else to do. Is there a way to save the file resulting from getimage.exe to the save folder? And also i am not sure how to get $imagename, which will be an image, pdf, or whatever. Any ideas? here is the code so far: <?php $alias = $_GET['ROOT']; $itnum = $_GET['ID']; $directoryToZip="temp/"; // This will zip all the file(s) in this present working directory $outputDir="temp/"; // this is where the error is Warning: copy(getimage.exe?CISOROOT=/achieve&CISOPTR=700) [function.copy]: failed to open stream: Invalid argument copy("getimage.exe?CISOROOT=".$alias."&CISOPTR=".$itnum , "temp/".$imagename); //from here down works. $zipName=".zip"; include_once("CreateZipFile.inc.php"); $createZipFile=new CreateZipFile; //Code toZip a directory and all its files/subdirectories $createZipFile->zipDirectory($directoryToZip,$outputDir); $zipName=time().$zipName; $fd=fopen($zipName, "wb"); $out=fwrite($fd,$createZipFile->getZippedfile()); fclose($fd); $createZipFile->forceDownload($zipName); @unlink($zipName); //echo ($zipName); //rename("temp/getimge.exe?CISOROOT=".$alias."&CISOPTR=".$itnum , "getimge.exe?CISOROOT=".$alias."&CISOPTR=".$itnum) ?> Thanks in advance. bardman6 PS the zip works when i remove the query strings and set $imagename to a constant.
The copy("getimage.exe?CISOROOT=".$alias."&CISOPTR=".$itnum , "temp/".$imagename); line looks dodgy to me. Basically you're asking the copy function to process and decode a dynamic stream (as called by getimage.exe), and as far as I know, it won't do that (hence the crash). Try this: $your_resource <<< exec("getimage.exe?CISOROOT=stuff&CISOPTR=more_blah_blah"); copy($your_resource,"temp/$imgname"); Basically, write the getimage.exe stream to a tangible something (a file) and then work it off from there.
That gives me first, a "Parse error: parse error, unexpected '<'" error, and I am not sure what you meant by '<<<' but I changed it to equals (does that mean something in PHP? Like I said, I am a PHP newbie!) and now I am getting unable to fork errors. After some research, I see that tends to be an IIS problem, which of course, I do not have access to, and even if I did, the administrators would probably not let me change it. Thanks Max for your response.