[FX.php List] [OFF] PHP question: Pulling in text from a file

Leo R. Lundgren leo at finalresort.org
Sat Mar 7 15:28:42 MST 2009


Bob,

If you haven't already, read http://www.php.net/manual/en/ 
features.file-upload.post-method.php . It contains information on how  
to handle uploaded files on the PHP side. It also hints on what you  
need on the client side.

In short the uploaded file is stored on the server in a temporary  
location. From there you can for example move the file to a permanent  
location, or you should be able to read the contents of the file, for  
example by file() which reads the file into an array where each  
element is one line, and returns this array, or file_get_contents()  
which reads the entire file and returns a string.

Actually there is some more to the issue information at http:// 
www.developershome.com/wap/wapUpload/wap_upload.asp?page=php4 (just  
the first page on the result when I googled), you might want to check  
that one first!

Cheers.


7 mar 2009 kl. 23.15 skrev Bob Patin:

> I'm trying to do this: select a file, have PHP read in the text and  
> put it into a variable.
>
> I'm using a form, and have tried several enctypes; right now I'm  
> experimenting with "text/xml" with no luck.
>
> Question: does anyone know how to take a POSTed file and read it  
> into a variable?
>
> here's what I've got so far:
>
> $postText = trim(file_get_contents('php://input'));
> echo $postText;
>
> Getting nothing back...
>
> Anyone help?
>
>
>
> Bob Patin
>
>
> <new_logo_idea3_120w.jpg>
>
> Longterm Solutions
> bob at longtermsolutions.com
> 615-333-6858
> http://www.longtermsolutions.com
> iChat: bobpatin
> AIM: longterm1954
> FileMaker 9 Certified Developer
> Member of FileMaker Business Alliance and FileMaker TechNet
> --------------------------
> FileMaker hosting and consulting for all versions of FileMaker
> PHP • Full email services • Free DNS hosting • Colocation • Consulting
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list