Re: Uploaded file
| From: | Richard Lynch | Date: | Fri, 27 Apr 2007 19:52:27 +0000 |
| Subject: | Re: Uploaded file | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-254024@lists.php.net to get a copy of this message | ||
On Thu, April 26, 2007 2:08 pm, Stut wrote:
> PHP wrote:
>> 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.
>>
>> But, I want to pass it to a class then manipulate the file, but it
>> does not work.
>>
>> $cMyClass->fnManipulateFile($file);
I suspect you are doing like this:
$file = $_FILES['file']['file_name'];
$cMyClass->fnManipulateFile($file);
You could do this instead:
$file = $_FILES['file'];
$cMyClass->fnManipulateFile($file);
Now you have an array coming in with all the elements you need,
file_name, error, original_name, etc.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?