Closed (fixed)
Project:
Webform
Version:
6.x-2.6
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
8 May 2009 at 09:02 UTC
Updated:
20 Jan 2010 at 06:17 UTC
Hello!
My form has a file field (Field Key: 'fileforupload').
Could anyone advise me how can I get access to the name (or path) of selected file in Additional Validation area?
The following code $form_values['submitted_tree']['fileforupload'] returns Array. And I don't know how to access the elements of this array.
Thank you in advance.
Comments
Comment #1
quicksketchI'd suggest installing the devel.module and using the dsm() function to look at the contents of the $form_values array. The file path should be in $form_values['submitted_tree']['fileforupload']['filepath'].
Comment #2
quicksketchComment #3
djandrey commentedThe array $form_values['submitted_tree']['fileforupload'] consists of one element only - ['new'], and code form_set_error('submitted][fileforupload', $form_values['submitted_tree']['fileforupload']['new']) always returns 'fileforupload' in spite of whether the file was selected or not. So your construction $form_values['submitted_tree']['fileforupload']['filepath'] doesn't work.
By the way, I've installed devel.module. Undoubtedly, this is a very useful module for the developers but number of elements of my array hasn't increased :)
Any ideas?
Comment #4
quicksketchHelp with custom coding is not provided in the Webform issue queue.