The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
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 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 |