you might have to scope the "fileField" attribute for the file upload for
one as it might be conflicting with the local var you are using for your
loop.

  _____  

From: cfaussie@googlegroups.com [mailto:cfaus...@googlegroups.com] On Behalf
Of Ben Lowndes
Sent: Wednesday, 17 June 2009 11:41 AM
To: cfaussie@googlegroups.com
Subject: [cfaussie] PHP to CF help


Hi, I've got a Cocoa app which posts data to a PHP script and I'd like to
switch out the PHP script for CF, but I can't seem to get it working.  


At the end of this email is the simplified (but working PHP script) followed
by my replacement CF script.

To debug I've also tried dumping and writing out the form, url & cgi scopes,
but I'm not seeing any form data being posted, yet the PHP script seems to
be accepting it without a problem.
Can anyone see what's going on here?  Does PHP handle posted form data
differently than I'm understanding?

Working PHP script:
<?php
$feedback_dir = '/path/to/write/to';

$feedback_files =
array('type','version','comment','email','exception','system','console','cra
shes','preferences','shell');

foreach($feedback_files as $file) {

  $dest = $feedback_dir . '/' . $file;

  $fh = fopen($dest, "w");

  if (!$fh) {
      // failed to create file
      echo "ERR 004 $file\n";
      echo "failed to create file";
      continue;
  }

  fwrite($fh, $_POST[$file]);

  fclose($fh);

  echo "OK 004 $file\n";
}
?>

My CF script:




<cfloop
list="type,version,comment,email,exception,system,console,crashes,preference
s,shell" index="thisFile">

<cftry>

  <cffile action="upload" destination="/path/to/write/to/#thisFile#"
fileField="#thisFile#">

<cfoutput>OK 004 #thisFile#</cfoutput>

<cfcatch type="any">

<cfoutput>

ERR O4 #thisFile#

failed to create file

</cfoutput>

</cfcatch>

</cftry>

</cfloop>





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to 
cfaussie+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to