Forums / Developer / Problem with custom module and file upload

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Problem with custom module and file upload

Author Message

Sébastien Antoniotti

Saturday 17 May 2008 8:34:34 am

Hi !

I'm writing a custom module who permit to upload a file.

Here is the basic form I'm using :

	<form enctype="multipart/form-data" method="post" action={"mymodule/send"|ezurl}>
		<input name="file1" type="file" size="20" />
		<input name="text1" type="text" value="lorem"/>                        
		<input type="submit" name="SendButton" value="send" />
	</form>

Here is the executed code behind the send view of my module :

echo "<pre>";print_r($_POST);echo "</pre>";

and the output after submitting the form is :

Array
(
    [text1] => lorem
    [SendButton] => send
)

I don't understand why the file1 attribute is not present in $_POST !

I precise that files uploads into the administration interface are OK, so I don't think that the problem is global to my server.

Please help me before I become crazy, I spent one hour to find a solution =(

Thanks in advance for your help !

eZ Publish Freelance
web : http://www.webaxis.fr

Bartek Modzelewski

Saturday 17 May 2008 9:34:45 am

Hi Sébastien,

sometimes developers forget about some obvious basic things ;-) Uploaded file data are in global $_FILES, not in $_POST.

http://pl2.php.net/features.file-upload

Cheers
Bartek

Baobaz
http://www.baobaz.com

Sébastien Antoniotti

Saturday 17 May 2008 12:13:54 pm

Hi Bartek,

Of course, it's so basic and I forgot it !

Many thanks because I was really nervous not succeed in making this thing so simple !!

Cheers,
Seb.

eZ Publish Freelance
web : http://www.webaxis.fr