Form Tools
File Upload field - Printable Version

+- Form Tools (
+-- Forum: Form Tools (
+--- Forum: API (
+--- Thread: File Upload field (/showthread.php?tid=207)

File Upload field - kmac - Jul 6th, 2009


I've created a review page for my form and it successfully loads all the fields that have been filled, except for the file upload.

Instead it displays the text "array".
I'm using

Should I be referencing fileurl?
Something like


RE: File Upload field - kmac - Jul 8th, 2009


Perhaps if I explain further.

In my form I have the following field:

<input id="intlUpload" name="intlUpload" type="file" class="file" value="<?=@$fields["intlUpload"]?>" />

In my review (results) page I have:
  if (!empty($fields['intlUpload']))
    echo "International PDF: " . $fields['intlUpload'] . "<br />";

When I test the form, the result looks like:
Quote:International PDF: Array

Another thing I should mention is that there are a number of file upload fields in the form, and only one of them shows in the results.

What am I doing wrong?
Since it's a file, should I be calling this differently? I couldn't find any examples in the documentation or in the tutorials (could be blind).


RE: File Upload field - Ben - Jul 11th, 2009


Any time you see "Array" printed to the screen, change your echo to a print_r instead. This is one of the minor annoyances of PHP - it doesn't have a generic print function to print any data type.

Add this to your page and see what it outputs:

My hunch is that the array will contain various info about the file upload field, like location, filename, URL etc. Once you've seen what it outputs, you can output an individual element of the array like this:

echo $fields["intlUpload"]["key_here"];

- where "key_here" is the array key.

Let me know if you get stuck on anything!

- Ben

RE: File Upload field - kmac - Jul 11th, 2009

Hi Ben,

Thanks for the reply. I'll definitely give it a go and let you know how I do.

Hey Ben,

Worked a treat!

Thanks so much - I would have never figured that one out.