PrivateFiles

Share downloads only with the users you want.

Back to PrivateFiles Support

dan12625
dan12625

I am trying to use the uploader component on the site front end and getting the titled error. In: /.../plugins/kurtjensen/privatefiles/components/Uploader.php line 190

public function onSave() {
    $this->myfile->user_id = $this->user->id;

Files will not upload. Am I missing a component on the page?

KurtJensen
KurtJensen

There must be a user logged in to front-end in order to upload files. I have added a warning to the component to make this more clear and avoid this error. Please update to version 1.1.10

dan12625
dan12625

A user is logged in. I can put {{ user.id }} to show me info.

Currently, I am running the session component (users only) and passing verification through a passage. The template like this:

{% if can('Schedules') %} {% component "Uploader" %} {% endif %}

So there are two components verifying a user.

KurtJensen
KurtJensen

Sorry you are having trouble dan12625 . I can not reproduce this error when a user is logged into front end. The plugin uses this code to get the logged in user:

public function init() {
    $this->user = Auth::getUser();
.... }

So I can not figure out how it is possible that you are having an issue here:

dan12625 said:

I am trying to use the uploader component on the site front end and getting the titled error. In: /.../plugins/kurtjensen/privatefiles/components/Uploader.php line 190

public function onSave() { $this->myfile->user_id = $this->user->id;

Files will not upload. Am I missing a component on the page?

What does it say the error is?

dan12625
dan12625

Here is a screen shot of the error

http://i.imgur.com/ec5BD1Y.jpg

Type: undefined, Exception: ErrorException

Perhaps I am missing a component on the page?

KurtJensen
KurtJensen

I suspect it is saying that there is an issue with $this->myfile not being an object. Run an update to see if some edits I made change the error.

You should only need the Upload component on the page.

Last updated

dan12625
dan12625

I ran the latest update, made no change to the page code, still getting the same error.

Perhaps I did not complete the install process correctly. I've created passage keys "upload" and "download," I have a user group with those passage's selected, and the user is in that group.

KurtJensen
KurtJensen

Thanks Dan for being patient while we discovered the issue over a private Google Hangout screen share.

For others that run into this, the issue was a missing "?" after the slug in the URL.

URL for uploader page should look something like "/uploads/:slug?".

The question mark makes the slug optional and in this case when there is no slug it shows you a list of uploads. When te slug = "new" it shows a blank form. When the slug is an integer like "2" it shows the form for the uploaded file with an id of 2 in DB for editing.

Last updated

1-8 of 8