I'm trying to use the CreateFileUploadInput method.
How do I get hold of the $fileUpload, $fileUpload_name, $fileUpload_size and $fileUpload_type variables?
Thanks,
Jon
CreateFileUploadInput
Re: CreateFileUploadInput
That's kind of a pain, actually.
Here's what I did in a module that required uploads. It assumes you've been called via the module interface, and you have the module's $id variable available (as you would in the DoAction method).
Basically, you make sure you create your form as enctype="multipart/form-data"
Then, in your code where you wish to access the file upload, you do something like this:
where 'fieldname' is what you called the field when you created the form.
Good luck!
___Samuel___
Here's what I did in a module that required uploads. It assumes you've been called via the module interface, and you have the module's $id variable available (as you would in the DoAction method).
Basically, you make sure you create your form as enctype="multipart/form-data"
Then, in your code where you wish to access the file upload, you do something like this:
Code: Select all
if (isset($_FILES[$id.'fieldname']['size']) && $_FILES[$id.'fieldname'] < $somelimit)
{
do something with $_FILES[$id.'fieldname']['name'] or $_FILES[$id.'fieldname']['type']
}
Good luck!
___Samuel___
Many modules available from the http://dev.cmsmadesimple.org
The CMS Made Simple Developer Cookbook is now available from Packt Publishers!
The CMS Made Simple Developer Cookbook is now available from Packt Publishers!
Re: CreateFileUploadInput
Thanks Samuel, this helped me a bit, but I still miss the temporary location of the uploaded file. Do you happen to know that too?
By the way I'm following your advicec in the Skeleton module. It is great reading! Hopefully I'll be able to create my first module.
-----------------------------------------------------------------
Found it: $_FILES[$id.'fieldname']['tmp_name']
Thanks,
Jon
By the way I'm following your advicec in the Skeleton module. It is great reading! Hopefully I'll be able to create my first module.
-----------------------------------------------------------------
Found it: $_FILES[$id.'fieldname']['tmp_name']
Thanks,
Jon
Last edited by jah on Thu Aug 11, 2005 8:36 pm, edited 1 time in total.