Welcome, Guest
Username: Password: Remember me

TOPIC: Where to place code

Where to place code 16 Jul 2013 06:33 #10476

  • beasty1711
  • beasty1711's Avatar
  • Offline
  • New Member
  • Posts: 19
  • Thank you received: 1
  • Karma: 0
Hi,

I'm wanting to add some code to parse a file once its been uploaded via the admin side of my component, however i cant see where it would live.

Any hints?

Thanks
The administrator has disabled public write access.

Where to place code 17 Jul 2013 05:07 #10482

  • BTB300
  • BTB300's Avatar
  • Offline
  • Moderator
  • Posts: 414
  • Thank you received: 130
  • Karma: 46
Would i be correct in thinking that it is uploaded in the front end but you want it to be stored on the admin side??

Anyhow you can set where the file is located in the component config. from the admin side toolbar select the config button in there you will find component permissions and component config (config button only available in administrator side)

by default its uploaded to
com_mycomponent/files/file_yourfieldname

you will see in component config an input box
- here you can define where the file is located when uploaded
- there are some predefined directories you can use such as [ROOT] [MEDIA]
- if you hover on the label you wil see the definitions available
- or you can create your own
- just a word of warning that if you just specify / in the box it will create it in the root of the drive such as c:\file_myfiled

So if you want it to go to admin side use [COM_ADMIN]/some_directory/ and it will be located in
[COM_ADMIN]/some_directory/file_[yourfieldname]
Last Edit: 17 Jul 2013 05:09 by BTB300.
The administrator has disabled public write access.

Where to place code 17 Jul 2013 08:19 #10487

  • beasty1711
  • beasty1711's Avatar
  • Offline
  • New Member
  • Posts: 19
  • Thank you received: 1
  • Karma: 0
Sorry, I didn't explain myself clearly.

I'm using the file upload data field to upload a csv file. I then want to add some code to read that file and insert the values into a different table.

What i'm asking is which file handles the writing of the file to disk so I can then add my additional code.


Thanks again.

Pete
The administrator has disabled public write access.

Where to place code 17 Jul 2013 11:06 #10489

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
The controller receive the task, so first create a function in the controller.

This controller function will work with models to insert datas.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.097 seconds

Get Started