Re: Uploaded file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2007. 04. 26, csütörtök keltezéssel 11.57-kor PHP ezt írta:
> Hi,
> How do I pass an uploaded file, from a form, to a class?
> 
> I have a file type on the form called file.
> 
> The variable $file is fine in my php code, can be used normally.

if you have $file then you are probably using register_globals. don't do
that. it's the source of evil.
use $_FILES instead

> 
> But, I want to pass it to a class then manipulate the file, but it does not work.
> 
> $cMyClass->fnManipulateFile($file);
> 
> the function fnManipulateFile gets $file only as the path the file was temporarily uploaded to (tmp/98rsof398)
> but the other variables are blank, such as $file_name.
> 
> is it possible to do this? or do I have to pass each one, like $file_name, $file_size, etc.?

if you use $_FILES you can pass $_FILES['file'] to the function

greets
Zoltán Németh

> 
> Thanks,
> Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux