Can't access $_FILES
(2012-08-27, 04:33 PM)euantor Wrote: EDIT: Actually, just thinking out loud here but is the $_FILES array possibly accessible via $mybb->input? I'm not entirely sure my self as I've never tried working with files in a plugin as I said.

I thought of that. Not unless I'm just not finding it. I tried $mybb->input['input_name'] and that just gets me the value in POST, which is the name, and I also tried $mybb->input['files'] and got nothing. Turning on errors only gets me a bunch of mybb warnings for undefined variables; nothing I can see that relates to files, so I turned them back off.
Ordo Ab Chao
"Insanity: doing the same thing over again and expecting different results." - Einstein
Right, I just tried the most simple example I could by adding a hook to the global_start and a form to the header template. The $_FILES variable can be accessed just fine there. About to try it within a mod cp template now.
Could you post your modcp_implementation template please? I'm now becoming even more certain it's because you have a form within a form.
Here's the template itself.

<title>{$mybb->settings[\'bbname\']} - {$lang->activate}</title>
<form action="modcp.php" method="post">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<table width="100%" border="0" align="center">
<td valign="top">



And here's what I process my page with

		// add content to the template
		eval("\$content = \$data;");
		// output the page
		eval("\$page = \"".$templates->get("modcp_implementation")."\";");

Oh my god I think I see it. You're right I think. The first form that holds the post_key is not closing before my content.

I'm not sure if that's how it's supposed to be, but I'll look at the template I used as an example and find out.

Wouldn't this have affected all the parts of the form? I go through 2 other parts before getting to the upload and have no issues.

THANK YOU!!!!!!!!!!!!!

That was it, it appears!! Smile
Ordo Ab Chao
"Insanity: doing the same thing over again and expecting different results." - Einstein
Yeah, I'm pretty sure it's that wrapper form. Looking at the source you gave me earlier, it's not even needed at all so you could just try removing it completely and see if it helps.

I would have thought it would affect the other parts but it's possibly because the outer form doesn't have the enctype specified.

Forum Jump:

Users browsing this thread: 1 Guest(s)