On 9/28/2011 12:07 AM, Anton Heuschen wrote:
> Good day,
>
> I have a question and something that either does not work, or I have not
> gotten it to work the way I want to.
>
> I have a start page, which is a form, that takes 2 text fields and also a
> Attachment field. Then it calls the first page, which is supposed to spawn
> of a call to another page (I want to get the page to open server side see,
> to allow the user to close the window, and the process continues in the
> background) ...so I use either passthru or have now tried system().
>
> The problem is that I can pass my 2 text fields as arguments to the call but
> I have a problem in accessing and using $_FILES now to handle the file
> defined.
>
> I have tried to pass it to a $_SESSION["FILES"] , I have even tried to
> serialize the whole array and pass it also as argument and build a array on
> called php page, etc, but it does not seem to do anything, or handle the
> file?
>
>
> As further example, this is on the first page opened from the Form :
>
> = php file 1 calling to file 2 =
>
> session_start();
> $_SESSION["FILES"] = $_FILES;
> session_write_close();
>
> $email = $_REQUEST['email'];
> $actionDate = $_REQUEST['actiondate'];
> $files = serialize($_FILES);
> $command = '/usr/bin/php -f /var/www/details/Write.php '.$email.'
> '.$actionDate.' '.$files.' >> php.log';
> system($command,$return);
At this point I would suggest that you echo $command before trying to execute
it.
I think you might find that you are trying to pass characters that the cli are
miss interpreting.
>
>
>
> =
>
> then in my called file
>
>
> Write.php =
>
> session_start();
> $FILES = $_SESSION['FILES'];
>
> $files1 = $FILES["coms1_attachfile"];
> $filename1 = $files1;
>
> ==
First, since you are calling this from the cli, their is no point in using
session_start(). session_start() has to do with running it in a web server not
from the cli.
Secondly, in file 1 you are using serialize() to package the $_FILES array. Yet
in file 2 you are not using unserialize() to extract the data from the package.
I would suggest reading here http://php.net/manual/en/features.commandline.php
to get a better understanding of how to access the arguments that you are
passing on the cli.
>
> $filename1 should now be recognized file name from a file provided in the
> first form, and if statement then runs the file to process to read the file,
> it seems here the process either does not get any file (so filename is never
> true) or the file process have no file to work with.
I'm curious as to what your initial HTML form looks like.
>
>
> So I am not really sure how passthru/system works with things like arrays
> and sessions and $_FILES array etc
>
arrays, not via the cli argument list
serialized arrays, sure, but you have to escape any special chars that might
mess things up.
sessions, does not exist
$_FILES, no direct access
Jim
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php