We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

$ _FILES | Forum

Patricia Zorrilla Leader
Patricia Zorrilla Oct 10 '19

I have a problem with a plugin that I am doing.

I have been removing things and more things to simplify and isolate the problem.

I don't know how to fix it. The problem is that $ _FILES is an empty array after uploading an image.

The main code is in the attached file, but you can download the test plugin from:

https://drive.google.com/open?id=18HvIkWq0rRfgS1rhG_eGvb2oXzsn3MfS

Do not install anything, do not create tables in the database, do not add keys in the language file ... Only have the minimum to see this problem.

Any help would be appreciated.


Attachments:
  admin.txt (2Kb)
Marcus
Marcus Oct 11 '19
Whay not using some like this..

$attachmentCmp = new BASE_CLASS_FileAttachment('forum', $uid);
$this->addComponent('attachments', $attachmentCmp);

Take a look at how photo pluging handles and validates photos and maybe avatar upload.

Join and edit profile both have similar to your code structure I suggest you start there

The Forum post is edited by Marcus Oct 11 '19
dave Leader
dave Oct 11 '19
After your new form add this


$form->setEnctype('multipart/form-data');



it tells the server you want a multipart form which includes $_FILES.   You do the same when doing this the old way in normal HTML using form type.