The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
File Upload field - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: API (https://forums.formtools.org/forumdisplay.php?fid=17)
+--- Thread: File Upload field (/showthread.php?tid=207)



File Upload field - kmac - Jul 6th, 2009

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


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

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!


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

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


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.

Cheers
Hey Ben,

Worked a treat!

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

Cheers