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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 04:22:25
Script start
Timing: Jan 19 2025 04:22:25
Module start 'layout'
Timing: Jan 19 2025 04:22:25
Module start 'content'
Timing: Jan 19 2025 04:22:26
Module end 'content'
Timing: Jan 19 2025 04:22:26
Script end

Main resources:

Total runtime1.1154 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0080 590.7656152.6250
Module start 'layout' 0.00800.0048 743.390639.4453
Module start 'content' 0.01281.1009 782.8359461.0078
Module end 'content' 1.11370.0017 1,243.84388.1563
Script end 1.1154  1,252.0000 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3059160.0002
Check MTime0.00130.1177160.0001
Mysql Total
Database connection0.00270.242210.0027
Mysqli_queries1.070295.9503540.0198
Looping result0.00070.0620520.0000
Template Total1.072796.220.5364
Template load0.00180.163720.0009
Template processing1.070996.010020.5354
Template load and register function0.00020.020910.0002
states
state_id_array0.00070.061510.0007
state_identifier_array0.00150.137220.0008
Override
Cache load0.00150.1352140.0001
Sytem overhead
Fetch class attribute can translate value0.00090.081720.0005
Fetch class attribute name0.00170.154520.0009
XML
Image XML parsing0.00030.024120.0001
class_abstraction
Instantiating content class attribute0.00000.000620.0000
General
dbfile0.00140.1214100.0001
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs