Forums

Setting path to File upload doesn't work

lopezio 22 Apr, 2011
Hi
I try to put a different path to my fileupload path but it simply doesn't work
On forCode->onsubmit code after sending emails I write the following code:

<?php
$searchpath = 'C:\xampp\xampp\htdocs\joomla\uploads\Grupo1';
$MyForm->setFormParam('uploadpath', $searchpath );
?>

Why it doesn't work?
I need to maintain the name of original file when I upload it. How can I do that?
Thank you
lopezio 22 Apr, 2011
My forms name is enviarficheiro_tic
If I use the following code (after sending email):

<?php
$enviarficheiro_tic->setFormParam('uploadpath', 'C:\delphiphp\enviar\lixo' );
?>

I get the error:

Fatal error: Call to a member function setFormParam() on a non-object in C:\xampp\xampp\htdocs\joomla\components\com_chronocontact\libraries\customcode.php(51) : eval()'d code on line 3
If I use the following code:

<?php
enviarficheiro_tic->setFormParam('uploadpath', 'C:\delphiphp\enviar\lixo' );
?>

I got the error

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in C:\xampp\xampp\htdocs\joomla\components\com_chronocontact\libraries\customcode.php(51) : eval()'d code on line 2
I'm lost, any help?
GreyHead 23 Apr, 2011
Hi lopezio,

Please see my reply to your other thread on folder names.

Bob
lopezio 26 Apr, 2011
Hi Greyhead
I read the post but I have problems: My version of Chronoforms is 3.2, not 4.0
Nothing happens when I put the folder in administrator/components/com_chronoforms/form_actions folder
I don't understand why this code doesn't work

<?php
enviarficheiro_tic->setFormParam('uploadpath', 'C:\delphiphp\enviar\lixo' );
?>

The file is allways uploaded to the Full Upload Path
GreyHead 26 Apr, 2011
Hi lopezio,

Sorry for getting the version wrong.

In CFv3.2 you can change the upload path on the File Uploads tab in the Form Editor. You can also set the File name in the same place.

Bob
lopezio 26 Apr, 2011
I Greyhead
It works if I set the path, the problem is that I need to set the path in a dynamic way. Here is my problem:
I have one login system, after the user logs in with sucess I want to allow he to upload files to a dynamic path (wich part of the path is the name of the user)
I need to setup the path dynamic
Thank you
GreyHead 05 May, 2011
Hi lopezio,

You can use PHP in the file name box on the Form Uploads tab so it's possible to add avariable folder there.

Bob

There's a doument I wrote on files and folders including the code you are looking for that you can buy for a few dollars here
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger