Allow Logged in Users to Access Upload Form

By Rusty - January 5, 2011

Using the membership plugin I am able to allow users to signup and create accounts within CMS Builder.

Within CMS Builder, they *could* go to www.mydomain.com/admin and use the upload form there to upload files to a record attached to a Mutli List Item.

However I don't want to have them go to the CMS Admin, and I don't want to redirect them to the CMS Admin.

I know the upload form functionality is there, the user can access it via the CMS Admin; here's what I'm curious about.

How can I get the uploadForm.php to function above the directory structure of CMS Builder?

Normally uploadForm.php resides in /admin/lib/menus/default/ and I know it calls upon uploadForm_functions.php, header_css.php, and jquery1.3.2.js
I tried adding the proper path to it but no dice, I only get the following error, and I've tried every permutation I can think of:

Warning: require_once(/admin/lib/menus/default/uploadForm_functions.php)
[function.require-once]: failed to open stream:
No such file or directory in /home/domain/public_html/uploadForm.php on line 3

Fatal error: require_once() [function.require]:
Failed opening required '/admin/lib/menus/default/uploadForm_functions.php'
(include_path='.:/usr/lib/php:/usr/local/lib/php') in
/home/domain/public_html/uploadForm.php on line 3

Rusty

Re: [Toledoh] Allow Logged in Users to Access Upload Form

By Rusty - January 5, 2011

Yeah, that's pretty much exactly what I was looking for. However after I added the Viewer Functions path, I get an error.
Array ( ) Fatal error: Call to undefined function getuploadinfoarrays() in /home/domain/public_html/uploadaddform.php on line 15

I guess that's not a plug & play form/snippet, I'm inclinded to think that the getuploadinfoarrays needs to be defined... (per the undefined function).
Rusty

Re: [Rusty] Allow Logged in Users to Access Upload Form

By Jason - January 6, 2011

Hi Rusty,

getUploadInfoArrays(); is a function that's built into CMS Builder. It should work as long as you're using CMSB version 2.04 or above. If you are, check line 4 to make sure you have the correct path to viewer_functions.php

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Allow Logged in Users to Access Upload Form

By Rusty - January 6, 2011

Hi Rusty,

getUploadInfoArrays(); is a function that's built into CMS Builder. It should work as long as you're using CMSB version 2.04 or above. If you are, check line 4 to make sure you have the correct path to viewer_functions.php

Hope this helps.


And that's my problem. Rocking 2.03. *wanders off to look at the upgrading requirements and review licensing*
Rusty

Re: [Rusty] Allow Logged in Users to Access Upload Form

By Jason - January 6, 2011

Hi Rusty,

Upgrading will take care of this for you. Upgrades are available by donation here:
http://www.interactivetools.com/upgrade/

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Allow Logged in Users to Access Upload Form

By Rusty - January 6, 2011 - edited: January 6, 2011

Hi Rusty,

getUploadInfoArrays(); is a function that's built into CMS Builder. It should work as long as you're using CMSB version 2.04 or above. If you are, check line 4 to make sure you have the correct path to viewer_functions.php

Hope this helps.


After updating to 2.06, when I load uploadForm.php in a browser I get this error now:
Notice: Undefined variable: tableName in /home/domain/public_html/admin/lib/menus/default/uploadForm_functions.php on line 3 loadSchema: no tableName specified!


The fact that it's mentioning the loadSchema made me go look at the /admin/data/schema/uploads.ini.php file.

Seems like the uploadForm.php which I copied to the /home/domain/public_html/ path can't find the uploads.ini.php file to define the schema for the array.

To date I've added the viewer functions to the top of the uploadForm.php file:
<?php
require_once "/home/domain/public_html/admin/lib/viewer_functions.php";
global $errors, $isUploadLimit, $uploadsRemaining, $maxUploads, $menu;
require_once "/home/domain/public_html/admin/lib/menus/default/uploadForm_functions.php";


and also copied uploadForm_functions.php to the same /home/domain/public_html/ path.

I wonder if it is something where I would need to declare it/the global variables, since normally this uploadForm.php is being called from within CMS Builder.
Rusty

Re: [Rusty] Allow Logged in Users to Access Upload Form

By Jason - January 7, 2011

Hi Rusty,

This shouldn't be a problem with your schema file. It is most likely that you're not correctly setting the name of the table you want to use.

At the top of uploadAddForm.php there should be this line:
$tableName = 'news';

You change the value from 'news' to the name of the section you want to upload to. You don't need to require uploadForm_functions.php since viewer_functions.php will take care of this.

If you're still having a problem, please attach the .php file you're working with so we can take a look at the code you're using.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/