Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 2220

phpBB Custom Coding • $request->file('files'); not working ?

$
0
0
Not sure if anyone can offer any advice to this..

The script was working until I started integrating phpbb request variables.

Basically I have a simple form which takes some files..

Code:

<form action="upload_util.php" method="POST" enctype="multipart/form-data">    <div align="center">        <input type="file" name="files[]" multiple>        <button type="submit" name="submit">Upload</button>    </div></form>
The snippet from the php script..

Code:

if ($request->is_set_post('submit')) {    // Retrieve uploaded files using the request class    $files = $request->file('files');    // Debug: print the $files array    echo '<pre>';    print_r($files);    echo '</pre>';
But it does not return my filenames..

Code:

Array(    [name] => none    [type] => none    [tmp_name] => none    [error] => none    [size] => none)Exactly
I should also note the phpbb session seems to be working because I can obtain the username from the user logged into the forum with echo $user->data['username_clean'];

Before phpbb integration it was working fine and I got the filenames. Now it seems to "forget" what was POSTed..

I've been looking around the Internet all morning and I cannot see what I am doing wrong here ?

I have tried passing a variable and that seems to work fine..

Code:

    // Retrieve the submitted variable using the request class    $myVariable = $request->variable('myVariable', '');

Code:

<input type="hidden" name="myVariable" value="example_value">
I can only assume it's because I am trying to upload files to my server and phpbb doesn't like me doing that. I took out all the phpbb stuff and files upload fine. So what I am trying to do, I assume simply can't work.

Statistics: Posted by exxos — Mon Jul 01, 2024 12:44 pm



Viewing all articles
Browse latest Browse all 2220

Trending Articles