Hi:

I want to upload a text file from the client browser to the server, but I don't want it saved anywhere on the server as a temporary file.

I just want to read the text directly into a string.

The text will contain info which must stay secure so I don't want it written to the hard disk.

Could anyone point me in the right direction?

Thanks,
Mark

    By design PHP uses the temporary file as a staging area so that it can be sure that the entire file is present before it returns a result. Unfortunately there is no way to cause PHP to do this directly (that I know of).

    The only way I can think to accomplish this would be to use a client side javascript to send a uuencoded version of the file as a POST variable. You could then recompose the file server side from the passed variable.

    My suggestion is ugly, but I don't know if there is another way. Please, someone have a more elegant answer?

      Having javascript send the file as a post varible sounds like a good option but:

      The javascript manual I checked said in chapter 1 that javascript can not read files.
      This makes sense; it would make javascript use more secure.

      Is there some sort of workaround for this limitation in javascript?

      Mark

        LOL, forgot about that. Like I said, my solution is ugly. Now that it's not a solution, that leaves just plain ugly. Looks like you may have to delve into actual java. I'm out of ideas... Good luck. 🙂

          Write a Reply...