Forums

Problems with DB and file names

Siphon 11 Dec, 2012
Hello,

Firstly I want to congratulated you for this great component. I am a noob and I have a few problems working with it.

Firstly, I want to work in a different database so I had read your tutorials and manuals along the forum and I did the following things:

1.- I create an username with all privileges on both database: Jommla and Mydatabase
2.- I go to advanced configuration and I check to log in the other database and I find the following messege: "DB Conection failed!"

How can I fix it?

The second question is more complicated. I want to store the filename I upload in my database. I had read the foum answer and I had cretated the following custom code before DB save action:

<?php
$formulario_id = $formulario->formrow->id;
$formulario->data['archivo'] = $formulario_id->data['_PLUGINS_']['upload_files']['archivo']['path'];
?>


And I do not store the filename in the current database

Here is the debugger section:

Data Array:

Array
(
    [option] => com_chronoforms
    [chronoform] => insertar_tesis
    [event] => submit
    [Itemid] => 
    [signatura] => 123456
    [autor] => Me
    [titulo] => This is a title
    [anio] => 1234
    [archivo] => 20121211091815_5 Saving data to the database.pdf
    [input_submit_17] => Guardar
    [271f8a0b15bd7f4edd279d7c03434bae] => 1
    [formulario] => Array
        (
            [cf_uid] => e364f3b9f8a82cabb1c969b9d222a944
            [cf_created] => 2012-12-11 09:18:15
            [cf_created_by] => 0
            [cf_ipaddress] => 127.0.0.1
            [cf_user_id] => 0
            [option] => com_chronoforms
            [chronoform] => insertar_tesis
            [event] => submit
            [Itemid] => 
            [signatura] => 123456
            [autor] => Me
            [titulo] => This is a title
            [anio] => 1234
            [archivo] => 
            [input_submit_17] => Guardar
            [271f8a0b15bd7f4edd279d7c03434bae] => 1
            [id] => 590
        )

    [formulario_id] => 590
    [_PLUGINS_] => Array
        (
            [upload_files] => Array
                (
                    [archivo] => Array
                        (
                            [name] => 20121211091815_5 Saving data to the database.pdf
                            [original_name] => 5 Saving data to the database.pdf
                            [path] => images\tesis\20121211091815_5 Saving data to the database.pdf
                            [size] => 290816
                            [link] => images/tesis/20121211091815_5 Saving data to the database.pdf
                        )

                )

        )

)

Validation Errors:

Array
(
)

Debug Data

    Upload routine started for file upload by : archivo
    images\tesis\20121211091815_5 Saving data to the database.pdf has been uploaded successfully.


Finally, ¿How can I change the name of the file stored on my upload directory?

Thank you very much
GreyHead 11 Dec, 2012
Hi Siphon,

The other database has to be accessible from the Joomla! site to make a connection. If it's in the same schema it probably is, otherwise you may need to set up permissions on the second database server to allow remote access.

If the database can be seen from Joomla! and the DB Save Advanced tab settings are correct then the record will save OK. There isn't anything else to check or to do.

Note: The databases don't have to have the same username and password, the connections are separate.

++++

To save the file name you need to have the Upload Files action *before* the DB Save action. Check your code carefully for 'form' and 'formulario'; the results will be in the $form->data array.

++++

You can change the name of an uploaded file by editing it using FTP; or by using a Custom Code action; or by using my Upload Files [GH] action which gives you more flexibility in naming uploaded files.

Bob
Siphon 11 Dec, 2012
Thank you for answering so soon Mr. GreyHead

The database is stored in the same server as Joomla's database is. If I want to enter on the database I have to copy all tables inside Joomla's database.

I have created different usernames and passwords and I have check those usernames have access to both databases but it doesn't work

I created an username called Prueba with password 1234
I granted all access level to joomla database (my joomla server) and my database

Here are some screenshots. I am stucked in this part

About filename issue: FIXED. Reason: I put events in bad order.

EDIT: I checked acount's conectivity with another module and it works (Joomla database if you allow ad) so I have no idea what's wrong😟

EDIT2: Added screenshots. Now file attached is lower than file upload limit🙂

Cheers!

PD: Thank you in advanced for taking your time with me
GreyHead 12 Dec, 2012
Hi Siphon,

The settings look OK as far as I can tell. You might try the mysqli driver and double check with your Joomla! configuration file that localhost is used as the DB host name.

After that I'm not sure what to suggest :-(

Bob
Siphon 12 Dec, 2012
Nope, I add my current test server configuration if you want to virtualize it.

It is strange because I can handle any table inside my joomla database but not outside it😟
GreyHead 12 Dec, 2012
Hi Siphon,

I don't see the Db host name in there. It would be in the site configuration.php file
	public $debug = '0';
	public $debug_lang = '0';
	public $dbtype = 'mysqli';
	public $host = 'frances';
	public $user = 'bob';

Bob
Siphon 14 Dec, 2012

Hi Siphon,

I don't see the Db host name in there. It would be in the site configuration.php file

	public $debug = '0';
	public $debug_lang = '0';
	public $dbtype = 'mysqli';
	public $host = 'frances';
	public $user = 'bob';

Bob



Oh sorry, here are the aditional information:


	public $debug = '0';
	public $debug_lang = '0';
	public $dbtype = 'mysql';
	public $host = 'localhost';
	public $user = 'joomla'; 


Everything checked and it isn't working yet😟
GreyHead 14 Dec, 2012
Hi Siphon,

That's it - looks OK.

You can try turning site debug on temporarily from the Site Global Configuration. That should show all of the DB calls and may give a clue what the error is. Though I'm not certain it will show calls to the second database :-(

Bob
This topic is locked and no more replies can be posted.