[Skip to main content](#vessel-content)

#   Insert data into another table (Database)

##

- **[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")**
- [![neo191987's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar35364.jpg)](/forum/user/35364-neo191987 "View neo191987's Profile") Topic Author
- [ Offline](/forum/user/35364-neo191987)

Less More

- Posts: 431
- Thank you received: 19
-
-

7 years 3 months ago -  7 years 3 months ago [\#309215](#309215) by [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")  *[Insert data into another table (Database)](/forum/2-general-talk-about-hikashop/897979-insert-data-into-another-table-database#309215 "Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong?")* was created by *[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")*

Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong? Code:

function onHikaBeforeFileSave(&amp;$file, &amp;$do) { $do = true; $file = new stdClass(); $file-&gt;file_path = 'myfilename.jpg'; $file-&gt;file_type = 'file'; $fileClass = hikashop_get('class.file'); $status = $fileClass-&gt;save($file); } function onHikaAfterFileSave(&amp;$file) { return onHikaBeforeFileSave($file, $do); }

Last edit: 7 years 3 months ago by [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5Nzk3OS1pbnNlcnQtZGF0YS1pbnRvLWFub3RoZXItdGFibGUtZGF0YWJhc2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

7 years 3 months ago [\#309219](#309219) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Insert data into another table (Database)](/forum/2-general-talk-about-hikashop/897979-insert-data-into-another-table-database#309219 "Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong?")*

Hi,

How are you uploading your file ? The Joomla media manager ? The upload function in the HikaShop products ? A CSV import ? Custom upload fields ?

Regarding the upload function in the HikaShop products, there are no triggers for now. You would have to use onBeforeProductCreate and onBeforeProductUpdate or onAfterProductCreate and onAfterProductUpdate to look for them in hikashop_file and add the information in the table if not already there.

We'll add triggers to the file saving process with the next version as I think it's a good idea. We'll add the triggers onBeforeFileCreate onBeforeFileUpdate onAfterFileCreate and onAfterFileUpdate

The following user(s) said Thank You: [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5Nzk3OS1pbnNlcnQtZGF0YS1pbnRvLWFub3RoZXItdGFibGUtZGF0YWJhc2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")**
- [![neo191987's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar35364.jpg)](/forum/user/35364-neo191987 "View neo191987's Profile") Topic Author
- [ Offline](/forum/user/35364-neo191987)

Less More

- Posts: 431
- Thank you received: 19
-
-

7 years 3 months ago -  7 years 3 months ago [\#309226](#309226) by [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")  Replied by *[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")* on topic *[Insert data into another table (Database)](/forum/2-general-talk-about-hikashop/897979-insert-data-into-another-table-database#309226 "Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong?")*

Hi, I tried to trigger but still did not respond. I suppose that the product_quantity should be updated after save. Is there a plugin responsible for these actions and must be enabled? I tried a few things, but they did not work?
Code:

function onBeforeProductUpdate(&amp;$element,&amp;$do) { $do = true; $element-&gt;product_quantity = 10; }

Last edit: 7 years 3 months ago by [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5Nzk3OS1pbnNlcnQtZGF0YS1pbnRvLWFub3RoZXItdGFibGUtZGF0YWJhc2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

7 years 3 months ago [\#309228](#309228) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Insert data into another table (Database)](/forum/2-general-talk-about-hikashop/897979-insert-data-into-another-table-database#309228 "Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong?")*

Hi,

I don't see why it wouldn't work.
Check that your plugin is installed and activated, and that you don't have a mass action on the product_quantity which could mess with this.

To check that your trigger is being called, set $do to false and save a product. If the save fails, it means that the code is being called.

The following user(s) said Thank You: [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5Nzk3OS1pbnNlcnQtZGF0YS1pbnRvLWFub3RoZXItdGFibGUtZGF0YWJhc2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")**
- [![neo191987's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar35364.jpg)](/forum/user/35364-neo191987 "View neo191987's Profile") Topic Author
- [ Offline](/forum/user/35364-neo191987)

Less More

- Posts: 431
- Thank you received: 19
-
-

7 years 3 months ago [\#309376](#309376) by [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")  Replied by *[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")* on topic *[Insert data into another table (Database)](/forum/2-general-talk-about-hikashop/897979-insert-data-into-another-table-database#309376 "Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong?")*

Hi, I was able to do whatever I wanted ![:)](/media/kunena/emoticons/3.png ":)") I want to ask when are triggers (onBeforeFileCreate onBeforeFileUpdate onAfterFileCreate and onAfterFileUpdate) expected to be available? That's exactly what I need. With each successive version, it gets better and better. Well done to the team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5Nzk3OS1pbnNlcnQtZGF0YS1pbnRvLWFub3RoZXItdGFibGUtZGF0YWJhc2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")**
- [![kyratn's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/redswirl.jpg)](/forum/user/38342-kyratn "View kyratn's Profile")
- [ Offline](/forum/user/38342-kyratn)

Less More

- Posts: 1119
- Thank you received: 114
-
- [](http://kyra.lt)
-

7 years 3 months ago [\#309381](#309381) by [kyratn](/forum/user/38342-kyratn "View kyratn's Profile")  Replied by *[kyratn](/forum/user/38342-kyratn "View kyratn's Profile")* on topic *[Insert data into another table (Database)](/forum/2-general-talk-about-hikashop/897979-insert-data-into-another-table-database#309381 "Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong?")*

Hi,

You may want to update your Hikashop to 4.2.1 version. As log states it is already available:

[[ www.hikashop.com/support/documentation/5...ashop-changelog.html](https://www.hikashop.com/support/documentation/56-hikashop-changelog.html)

Thanks

The following user(s) said Thank You: [nicolas](/forum/user/63-nicolas "View nicolas's Profile"), [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5Nzk3OS1pbnNlcnQtZGF0YS1pbnRvLWFub3RoZXItdGFibGUtZGF0YWJhc2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")**
- [![neo191987's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar35364.jpg)](/forum/user/35364-neo191987 "View neo191987's Profile") Topic Author
- [ Offline](/forum/user/35364-neo191987)

Less More

- Posts: 431
- Thank you received: 19
-
-

7 years 3 months ago [\#309388](#309388) by [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")  Replied by *[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")* on topic *[Insert data into another table (Database)](/forum/2-general-talk-about-hikashop/897979-insert-data-into-another-table-database#309388 "Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong?")*

Hi, is it possible to add and onAfterFileDelete. I want to trigger some things after deleting. Is it possible at the moment?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5Nzk3OS1pbnNlcnQtZGF0YS1pbnRvLWFub3RoZXItdGFibGUtZGF0YWJhc2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

7 years 3 months ago [\#309392](#309392) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Insert data into another table (Database)](/forum/2-general-talk-about-hikashop/897979-insert-data-into-another-table-database#309392 "Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong?")*

Hi,

You can add the code: Code:

JPluginHelper::importPlugin('hikashop'); $app = JFactory::getApplication(); $app-&gt;triggerEvent('onAfterFileDelete', array( &amp;$pkeys, &amp;$type ));

after : Code:

$translationHelper = hikashop_get('helper.translation'); $translationHelper-&gt;deleteTranslations('file',$elements);

in the file administrator/components/com_hikashop/classes/file.php
We'll add that on our end too.

The following user(s) said Thank You: [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5Nzk3OS1pbnNlcnQtZGF0YS1pbnRvLWFub3RoZXItdGFibGUtZGF0YWJhc2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")**
- [![neo191987's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar35364.jpg)](/forum/user/35364-neo191987 "View neo191987's Profile") Topic Author
- [ Offline](/forum/user/35364-neo191987)

Less More

- Posts: 431
- Thank you received: 19
-
-

7 years 3 months ago [\#309401](#309401) by [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")  Replied by *[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")* on topic *[Insert data into another table (Database)](/forum/2-general-talk-about-hikashop/897979-insert-data-into-another-table-database#309401 "Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong?")*

Hi, thank you. I have one last question on how to get information in this function. onAfterFileUpdate(&amp;$file)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5Nzk3OS1pbnNlcnQtZGF0YS1pbnRvLWFub3RoZXItdGFibGUtZGF0YWJhc2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

7 years 3 months ago [\#309405](#309405) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Insert data into another table (Database)](/forum/2-general-talk-about-hikashop/897979-insert-data-into-another-table-database#309405 "Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong?")*

Hello,

You should have every information you need through the $file variable, could you give us more information about the information you'll need ? Thank you.

Kind regards,
Mohamed Thelji

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5Nzk3OS1pbnNlcnQtZGF0YS1pbnRvLWFub3RoZXItdGFibGUtZGF0YWJhc2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")**
- [![neo191987's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar35364.jpg)](/forum/user/35364-neo191987 "View neo191987's Profile") Topic Author
- [ Offline](/forum/user/35364-neo191987)

Less More

- Posts: 431
- Thank you received: 19
-
-

7 years 3 months ago [\#309434](#309434) by [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")  Replied by *[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")* on topic *[Insert data into another table (Database)](/forum/2-general-talk-about-hikashop/897979-insert-data-into-another-table-database#309434 "Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong?")*

Hi, I need file_id. But if I can get change even better. I tried through $file-&gt;file_id, but var_dump returns NULL.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5Nzk3OS1pbnNlcnQtZGF0YS1pbnRvLWFub3RoZXItdGFibGUtZGF0YWJhc2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

7 years 2 months ago -  7 years 2 months ago [\#309482](#309482) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Insert data into another table (Database)](/forum/2-general-talk-about-hikashop/897979-insert-data-into-another-table-database#309482 "Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong?")*

We have high on our todo list to update the developer documentation to add all the new triggers missing, including this one.
This one is a simple one. It's just triggered when a file is being updated. It's triggered when you click on the "ok" button of the image / file edition popup of a product / category in the backend. I think you can do a var_dump of $file and then an exit in that function of your plugin to see the var_dump in the image edition popup after you click on that ok button.

Now, looking at the code of the "save" function in administrator/components/com_hikashop/classes/file.php I can see an issue with the code there.
The lines:
if(empty($new)) {
should actually be:
if($new) {
I think that's why you have that issue.

Last edit: 7 years 2 months ago by [nicolas](/forum/user/63-nicolas "View nicolas's Profile").

The following user(s) said Thank You: [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5Nzk3OS1pbnNlcnQtZGF0YS1pbnRvLWFub3RoZXItdGFibGUtZGF0YWJhc2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")**
- [![neo191987's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar35364.jpg)](/forum/user/35364-neo191987 "View neo191987's Profile") Topic Author
- [ Offline](/forum/user/35364-neo191987)

Less More

- Posts: 431
- Thank you received: 19
-
-

7 years 2 months ago -  7 years 2 months ago [\#310129](#310129) by [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")  Replied by *[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")* on topic *[Insert data into another table (Database)](/forum/2-general-talk-about-hikashop/897979-insert-data-into-another-table-database#310129 "Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong?")*

Hi, how can i get it file_id onAfterFileCreate(&amp;$file), i got all the information through $file but without file_id.

To clarify exactly what needs to happen, I will write in detail. After uploading a file through Hikamarket (products - front end), information is sent to the trigger, which in turn creates a new row in the database.

Last edit: 7 years 2 months ago by [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5Nzk3OS1pbnNlcnQtZGF0YS1pbnRvLWFub3RoZXItdGFibGUtZGF0YWJhc2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

7 years 2 months ago [\#310145](#310145) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Insert data into another table (Database)](/forum/2-general-talk-about-hikashop/897979-insert-data-into-another-table-database#310145 "Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong?")*

Hi,

That's a good point. You can add the line:
$file-&gt;file_id = $status;
before the line:
$app-&gt;triggerEvent('onAfterFileCreate', array( &amp;$file ));
in administrator/components/com_hikashop/classes/file.php so that you'll get the file_id in the trigger.
We'll do the change on our end too for the next version.

The following user(s) said Thank You: [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5Nzk3OS1pbnNlcnQtZGF0YS1pbnRvLWFub3RoZXItdGFibGUtZGF0YWJhc2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")**
- [![neo191987's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar35364.jpg)](/forum/user/35364-neo191987 "View neo191987's Profile") Topic Author
- [ Offline](/forum/user/35364-neo191987)

Less More

- Posts: 431
- Thank you received: 19
-
-

7 years 2 months ago [\#310156](#310156) by [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")  Replied by *[neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")* on topic *[Insert data into another table (Database)](/forum/2-general-talk-about-hikashop/897979-insert-data-into-another-table-database#310156 "Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong?")*

Thank you. Could you add in the next version and the trigger "FileDelete" ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5Nzk3OS1pbnNlcnQtZGF0YS1pbnRvLWFub3RoZXItdGFibGUtZGF0YWJhc2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86322
- Thank you received: 14281
-
-

7 years 2 months ago [\#310157](#310157) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Insert data into another table (Database)](/forum/2-general-talk-about-hikashop/897979-insert-data-into-another-table-database#310157 "Hi, I want to ask if it is possible that when uploading a file, the data about it will also be imported into another table. I found this code but it does not work. Where am I wrong?")*

Hi,

There's already a trigger after delete:
onAfterFileDelete( &amp;$ids, &amp;$type )
where $type is the type of file being deleted (category, file, watermark, image) and $ids a list of ids of files deleted.

The following user(s) said Thank You: [neo191987](/forum/user/35364-neo191987 "View neo191987's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg5Nzk3OS1pbnNlcnQtZGF0YS1pbnRvLWFub3RoZXItdGFibGUtZGF0YWJhc2U/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.092 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
