No, this is not implemented with AMFPHP. Basically, I create a link "Export to Excel" with a click event that does a navigateToURL(exportDataURL,"_top"). The exportDataURL is the URL of the PHP script that generates the spreadsheet (As I showed in my last post).
So, there are no files to create/delete - the script generates a stream that is sent back to the client. They can choose to save the file or open with Excel. Everything works splendidly. --- In [email protected], "aphexyuri" <[EMAIL PROTECTED]> wrote: > > Are you implementing this in AMFPHP? The reason why I'm asking, is > because I came across a post yesterday that said something about > AMFPHP taking over / managing all the headers to and from the client. > I can't remember he details, but that was the gist of it. > > So, came up with a more elegant (I think) solution...I used PEAR > Spreadsheet_Excel_Writer package to create a .xls file server > side(Btw, the package is awesome, you can practically set formatting > to any field, almost to the same level as you can actually do it in > Excel). > > I then send the file location back to Flex, and use FileReference to > present a download file browser to the user. > > After save or cancel, I send a msg to amf to remove unlink the file > from the server...Boom...the Flex way! > > Thanks for your help tho!!! > > --- In [email protected], "valdhor" <stevedepp@> wrote: > > > > I do this all the time from PHP. Here are the functions that I use: > > > > function sendHeader($FileName) > > { > > header("Pragma: public"); > > header("Expires: 0"); > > header("Cache-Control: must-revalidate, post-check=0, > pre-check=0"); > > header("Content-Type: application/force-download"); > > header("Content-Type: application/octet-stream"); > > header("Content-Type: application/download"); > > $DispositionHeader = "Content-Disposition: attachment;filename=" . > > $FileName . ".xls"; > > header($DispositionHeader); > > header("Content-Transfer-Encoding: binary"); > > } > > > > function xlsBOF() > > { > > echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0); > > return; > > } > > > > function xlsEOF() > > { > > echo pack("ss", 0x0A, 0x00); > > return; > > } > > > > function xlsWriteNumber($Row, $Col, $Value) > > { > > echo pack("sssss", 0x203, 14, $Row, $Col, 0x0); > > echo pack("d", $Value); > > return; > > } > > > > function xlsWriteLabel($Row, $Col, $Value ) > > { > > $L = strlen($Value); > > echo pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L); > > echo $Value; > > return; > > } > > > > And here is how I would use these functions: > > $FileName = "MyFileName"; > > sendHeader($FileName); > > xlsBOF(); > > //xlsWriteLabel($Row, $Col, $Value ); > > xlsWriteLabel(0, 0, "Name"); > > xlsWriteLabel(0, 1, "Age"); > > $xlsRow = 1; > > arsort($theArrayIWantToSend); > > foreach ($theArrayIWantToSend as $key => $value) > > { > > //xlsWriteLabel($Row, $Col, $Value ); > > xlsWriteLabel($xlsRow, 0, trim($key)); > > //xlsWriteNumber($Row, $Col, $Value ); > > xlsWriteNumber($xlsRow, 1, $value); > > $xlsRow++; > > } > > xlsEOF(); > > > > You use xlsWriteLabel to write a string and xlsWriteNumber to write a > > number. > > > > --- In [email protected], "aphexyuri" <yurivssr@> wrote: > > > > > > Hi > > > > > > Help will be greatly appreciated... > > > > > > I need to make a .xls file available for download with data from a > > > datagrid. > > > > > > I'm using AMFPHP, as the datagrid info can be a lot, but i'm having > > > trouble prompting the user for the download. > > > > > > The data gets to AMFPHP ok, then I build tab delimited string from an > > > incomming array, and that is where I'm stuck...getting that string to > > > a .xml file prompt for download, without saving the file to the > > server. > > > > > > Any help please? > > > > > >

