Keyword

Upload attachment to article id (itemID) folder

More
12 years 4 months ago #66034 by mohib
To change the location of where you want the files to uploaded to do, you have to do the following
NOTE: you have to move the files and create the folders for the existing articles. Contact me if you have questions.
  1. In Joomla Administration, go to Components->K2->Items
  • Click on Parameters in the Menu tab (same line as KB Items)
  • In the advanced tab in the parameters menu, enter the folder name for Change root attachment
  • folder
  • for some reason, the attachments are put under the administration folder. This is important for the latter steps

  • Save and close the parameters tab. Next is php code
  • The file you want to edit is located under [joomla Directory]\administrator\components\com_k2\models\item.php
    1. Using notepad++, you can search for 'attachmentsFolder'. There should be three instances
    2. For the first instance, change the code
    3. from $path = $params->get('attachmentsFolder', NULL);
    4. to $path = $params->get('attachmentsFolder', NULL)."/".$row->id;
    5. For second instance, change the code
    6. from $path = $params->get('attachmentsFolder', NULL).;
    7. to $path = "administrator\\".$params->get('attachmentsFolder', NULL)."\\".$attachment->itemID;

    8. For the third instance, change the code
    9. from $path = $params->get('attachmentsFolder', NULL);
    10. to $path = "administrator\\".$params->get('attachmentsFolder', NULL)."\\".$itemID;

  • thats it. Save the file. Restarts IIS or Apache and you should be good to go.
  • Please Log in or Create an account to join the conversation.


    Powered by Kunena Forum