PHP Program Execution Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gojuka@si.rr.com

    PHP Program Execution Problem

    Hi All

    Im having a minor issue performing a system command with exec(). I
    want to use the filenames of files that I uploaded within the command,
    but cannot escape once inside the exec() function. For example, lets
    say I just uploaded two files, file1.txt and file2.txt. I want to list
    the contents of those two files by using the command:

    cat file1.txt file2.txt

    But I'm having problems using the names of the files uploaded. I used
    a for loop to grab each file name and put them in an array, and can
    successfully view the array to verify its contents. The problem occurs
    when I try this:

    exec('cat " . $Array['0'] . " ....blah blah

    This is just an example so you can understand what Im trying to
    accomplish.

    TIA
    Rob

  • Steve

    #2
    Re: PHP Program Execution Problem

    [color=blue]
    > cat file1.txt file2.txt[/color]
    [color=blue]
    > But I'm having problems using the names of the files uploaded. I used
    > a for loop to grab each file name and put them in an array, and can
    > successfully view the array to verify its contents. The problem occurs
    > when I try this:[/color]
    [color=blue]
    > exec('cat " . $Array['0'] . " ....blah blah[/color]

    You probably need to move the files from the temporary upload directory
    before you can process them.

    See <http://www.php.net/features.file-upload> and
    <http://www.php.net/manual/en/function.move-uploaded-file.php>.

    ---
    Steve

    Comment

    Working...