and I get: Dateiname: !!Is there a chance to get a grip on the file name BEFORE the Upload Files action runs ?Thx a lot,Doris"> Field with filename not filled before Upload action ? - Forums

Forums

Field with filename not filled before Upload action ?

doromi 08 Oct, 2013
Hi,

in my form I have a File Upload element

<input type="hidden" name="dateiname" value="" alt="ghost" />
<input id="dateiname" title="" type="file" name="dateiname" />

and the corresponding Upload Files [GH] action. The upload works nicely.

But - when I use the form and choose the file - the field in the data array for the file name stays empty until the Upload Files action finished.

To confirm the empty array field I added a Custom Code before the Upload Files action
<?php 
echo "Dateiname: !" . $form->data['dateiname'] ."!<br>";
?>

and I get: Dateiname: !!

Is there a chance to get a grip on the file name BEFORE the Upload Files action runs ?

Thx a lot,
Doris
GreyHead 08 Oct, 2013
Hi Dorothy,

What are you actually trying to do?

You can get the name of the uploaded file from the $_FILES array, but, as the Upload Files action may change the name, the saved name could be different. If you configure the Upload Files action to include a random string or a date-time element then you can't reliably know what it is beforehand.

Bob
doromi 08 Oct, 2013
Hi Bob,

it's Doris๐Ÿ˜‰

Thanks for your answer.

I was thinking about different actions depending on the chosen file, now that I got the Event Switcher running...

Where do I find the $_FILES array ?

Thx,
Doris
GreyHead 08 Oct, 2013
Hi Doris,

The $_FILES array is the PHP array with the information about uploaded files. More information in the PHP Manual here.

Bob
doromi 08 Oct, 2013
Thanks, Bob,

I found it AND I can work with the data ๐Ÿ˜€

Doris
This topic is locked and no more replies can be posted.