FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
File Upload field
#1
Hi,

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
Code:
<?=@$fields["soloUpload"]?>

Should I be referencing fileurl?
Something like
Code:
<?=@$fileurl["soloUpload"]?>

Cheers
Reply
#2
Anyone?

Perhaps if I explain further.

In my form I have the following field:

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

In my review (results) page I have:
Code:
<?php
  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).

Help!
Reply
#3
Heya,

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:
Code:
print_r($fields["intlUpload"]);

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:

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


- where "key_here" is the array key.

Let me know if you get stuck on anything!

- Ben
Reply
#4
Hi Ben,

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

Cheers
Hey Ben,

Worked a treat!

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

Cheers
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)