e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
321 stars 213 forks source link

[Question] How to add file uploader for members #1932

Closed nesjett closed 6 years ago

nesjett commented 7 years ago

Is there any form function or shortcode to add a multifile uploader?

Also, I tried using the filepicker() method, but it doesnt allows the upload to non admin accounts. Maybe am I missing some param/config...?

Thanks,

Moc commented 7 years ago

Hi,

Some questions.

If its the admin area then you can use the Admin UI (see plugin builder) and use type='files' If it's for the frontend then I am not completely sure why the filepicker() method doesn't work.

nesjett commented 7 years ago

I dont get any error, it works, uploads the file, but when it reloads the modal, the file just uploaded its not there nor in the file system. At first I noticed some kind of bug in the latest stable version, and It was that avatar uploading is not working. At first I thought that it could happen due to file permissions, but now Im wondering if that is related with the filepicker() too.

PD: As a small note, the profile link to update the avatar picture is not working as espected, it has a bad redirect.

I´m using latest stable version, not github one, Ill try to update and see if its solved.

Moc commented 7 years ago

I´m using latest stable version, not github one, Ill try to update and see if its solved.

That should definitely solve a lot of issues. Hopefully also the one you are experiencing :)

nesjett commented 7 years ago

Well, updating the cms to the git version solved the problem about not to be able to upload avatars, but still cant upload files trought the filepicker() if you are not admin (on frontend)

Issue #1933 persists too.

Moc commented 7 years ago

Labelled as bug, this needs to be looked into.

I suppose the filepicker method needs updating to also allow for non-admin users to upload files.

Test code:

<?php
require_once("class2.php");
require_once(HEADERF);

$sql = e107::getDb();
$ns = e107::getRender();
$frm = e107::getForm();
$text = '';

if(isset($_POST['formname']))
{   
    print_a($_POST);
    $ns->tablerender("Test form", "Submitted!");
}
else
{
   $text .= $frm->open('formname', 'post', e_REQUEST_URI);
   $text .= $frm->filepicker('test', '');
   $text .= $frm->button('formname', LAN_SUBMIT);
   $text .= $frm->close();

   $ns->tablerender("Test form", $text);
}

require_once(FOOTERF);
exit;
CaMer0n commented 7 years ago

Please see http://www.w3schools.com/tags/att_input_multiple.asp and e107::getFile()->getUploaded();