are you URLEncoding( the data after compression? On 27 March 2011 12:05, Dan Friedman <d...@clearvisiontech.com> wrote:
> Gentlemen, > > My goal is to upload compressed data to a file on a sever. I don't want to > use ftp. So, I am trying to use a php script. I am getting Rev to POST the > data, and I have a PHP script on my server that is writing the data. The > problem is that the data that is written is incorrect. Not really sure if > it's corrupted or if it's being wrapped with something or what. I think I > am POSTing the data correctly and the problem is in the PHP. But, I could > be wrong (wouldn't be the first time!). Any assistance anyone has would be > GREATLY appreciated! > > Here is my script from LiveCode: > > put "" into tPostData > if libUrlMultipartFormData(tPostData,"DID",getDID(),"TID",sTeacherID) is > not "" then > --there was an error. deal with it. > > else > set the httpHeaders to line 1 of tPostData > delete line 1 of tPostData > if > libUrlMultipartFormAddPart(tPostData,"TDATA",rctDataToWrite,"application/binary","binary") > is not "" then > --there was an error. deal with it. > > else > put "http://www.myserver.com/folder1/saveData.php" into phpAddress > post tPostData to url phpAddress > end if > end if > > Here is my php script: > > <?php > > $dCode = $_POST["DID"]; //the DCode > $sTeacherID = $_POST["TID"]; //the Teacher ID Number > $theData = $_POST["TDATA"]; //the compressed data to write > > //construct file path > $sFileName = $dCode . "/someFolder/" . $sTeacherID . ".rct"; > > if (is_writable($sFileName)) { > if (!$handle = fopen($sFileName, 'wb')) { > echo "ERROR 100: Cannot open file."; > exit; > } > > // Write $theData to the file. > if (fwrite($handle, $theData) === FALSE) { > echo "ERROR 101: Cannot write to file."; > exit; > } > > echo "Success, wrote ($theData) to file ($sFileName)"; > > //close the file > fclose($handle); > > } else { > echo "ERROR 102: The file is not writable ($sFileName)."; > } > ?> > > > Again, any assistance anyone has would be GREATLY appreciated! > > -Dan > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > -- Stephen Barncard San Francisco Ca. USA more about sqb <http://www.google.com/profiles/sbarncar> _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode