Forums / Developer / Get information on posted file data

Get information on posted file data

Author Message

Nathalie Grimaud

Wednesday 07 December 2005 6:39:29 am

Hi,
In a template I have a simple form with an <input type="file" name="myfile"> field inside.
In the target template I easily get the value of this field using ezhttp('myfile') but how can I get other information like using $_FILES['myfile']['tmp_name'] in php ?

Thanks for your help
Nathalie

Clemens T

Wednesday 07 December 2005 8:35:48 am

Ok, you need to dive into the kernel to get the answer, here are some pointers:

...
	include_once( 'kernel/classes/ezcontentupload.php' );

    	if ( $http->hasPostVariable( 'UploadLocationChoice' ) )
    	{
		$node_to_upload_to = $http->postVariable('UploadLocationChoice');
	} else {
		$node_to_upload_to = 207;
	}
	$upload = new eZContentUpload( array() );
	$upload->handleUpload( $result, 'UploadFile', $node_to_upload_to, false );
...

this is code I copied from some old module of mine.. hopefully you can get some info on it. For more detail, checkout the eZContentUpload::handleUpload function( ..'kernel/classes/ezcontentupload.php' is where you can find it).

Greets,
Clemens