upload directly into a resource?
| From: | Paul Halliday | Date: | Mon, 03 May 2010 21:21:40 +0000 |
| Subject: | upload directly into a resource? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-304888@lists.php.net to get a copy of this message | ||
I have some code that is currently static. It runs via Cron,
generating images which can then be viewed via some other PHP.
What I want to do is allow a user to upload data which I can then pipe
directly into the existing program to produce on the fly images. I am
looking at this:
http://www.php.net/manual/en/features.file-upload.post-method.php
My existing code looks like this:
$theData = aQuery($gType, $gSdate, $gStime, $gEdate, $gEtime, $gFilter, $base);
while ($row = mysql_fetch_array($theData[0])) {
$hit = "yes";
$src_ip[] = $row[0];
$dst_ip[] = $row[1];
$sig_desc[] = wordwrap($row[2],20,"\\n");
if ($gType == 02) {
$hit_count[] = $row[3];
}
$rec ++;
if ( $rec == $recCount ) {
break;
}
}
// Open Afterglow and feed it our results
$glowCmd = "$glowPath -c $glowProps $glowArgs | $dotPath $dotArgs $dotOut";
$dspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("file", "$glowErr", "a")
);
$process = proc_open($glowCmd, $dspec, $pipes, $baseDir);
....
If you are following the gist, what is the easiest way to put the
uploaded file into "$theData"?
aQuery just returns the result of a mysql select; so is it just a
matter of using fgetcsv as the action in the stub taken from the file
upload link?
Thanks.