Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

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

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

Please Log in or Create an account to join the conversation.

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

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]

Please Log in or Create an account to join the conversation.

Last edit: by BTB300.

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

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

Please Log in or Create an account to join the conversation.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.084 seconds

Although I found this tool some time ago I just started learning experimenting and building this first component on Monday and now on Thursday afternoon it's already online. Although I already had a working version done with another tool this is much easier to build and at the end you have the freedom to own your own component. Once you know how to use Cook you will boost your productivity as the learning curve is really moderate compared to many other tools.
Giori (Forum)

Get Started