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



Form Tools
Repopulating $_FILES upon failed validation - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5)
+--- Thread: Repopulating $_FILES upon failed validation (/showthread.php?tid=608)



Repopulating $_FILES upon failed validation - Jaace - Mar 25th, 2010

I've been reading up on input type file around the net and it seems that it's a security issue, and thus not possible, to repopulate the input type file value with anything at any time.

But I have a problem...in my form, I'm doing just server-side validation right now and when something fails, my uploads go away. I checked and saw that the $_FILES array was getting sent back to the form, so I thought I could use that to repopulate the files that the user already selected...but no luck.

Is there any way I can accomplish repopulating uploaded file fields when a form doesn't validate?

It's really a pain for a user to have to go through choosing all of their files again just because an email address was mis-spelled, you know?

Thanks for the help!


RE: Repopulating $_FILES upon failed validation - Ben - Mar 28th, 2010

Hi Jaace,

Unfortunately not... at least, not without a lot of customization. Form submissions that contain a file are sort of "one shot deals". From a server-side perspective, you have access to that uploaded file at that one time only. You can't access the uploaded file on the subsequent form submit - this is forbidden, mostly for security reasons.

But this is very reasonable request. I've logged it as a bug, here:
http://bugs.formtools.org/index.php?cmd=view&id=211

To be perfectly honest, I'm not sure how to elegantly solve it. I think it may need a custom function added. Blurgh, very messy.

Sorry, Jaace. I'll have to investigate this in an upcoming version of the API.

- Ben


RE: Repopulating $_FILES upon failed validation - Jaace - Mar 28th, 2010

No worries Ben! Thanks for considering it though :-). If I come up with anything myself I'll be sure to send it over your way.

Cheers!