11 years ago
5
Topic

Hi

Anyone here knows how to create txt file based on the value that we submit on the form

example:

i have 3 field

image upload, title, description (wysiwyg),

after the form is saved, i need to create a txt file at the same folder as image upload folder with formatted text content as :

image_file_name:title value:description value

Hope anyone here can help me :)

Get a Book for SEBLOD
11 years ago
4
Level 1

Hello mdhugol,

you can use the plugin field code AfterStore for doing that.

The php code will be executed just after the form is saved.

By looking at the variables $fields (use jdump) you will have all informations you need for doing that.


Regards.

Lionel

11 years ago
3
Level 2

Is there's any support offered by this product.?

in case i need an example of code to put in the field

11 years ago
2
Level 3

Hello mdhugol,


simply put a field based on the plugin code "afterstore" in your form.

Then in the field configuration, in the textarea "Free", write your code to create your field in the good folder.


To define the folder of the image, look at the variable  with a dump( $fields['name_of_upload_image_field'] );

You will have all informations to store you file in the good folder.


The support is based on how to use those plugin, but we can't make all the custom code for you.


Regards.

Lionel

11 years ago
1
Level 4

Hi, i have downloaded the product and trying to put simple php code to create a file

$File = "images/1/en-GB.labels.txt";
$Handle = fopen($File, 'w');
$Data = "Penguins.jpg|Penguins|Penguins Example";
fwrite($Handle, $Data);
fclose($Handle);

The code with and without a php tag, but nothing happen, do you have any idea why.?


EDIT: Wrong images directory should be "../images/1/en-GB.labels.txt" :)

11 years ago
0
Level 5

Hello mdhugol,


Don't put the <?php & ?> code.

I advice you to use JDump to debug your code, so you will see what happen in your field.

The second thing is that you can use Joomla framework in those field, like JFile, JFolder, .... it will be more simple to write your need.


regards.

Lionel

Get a Book for SEBLOD