- Posts: 34
COMMUNITY FORUM
SOLVED: K2 attachments
- ljk
- Topic Author
- Offline
- Junior Member
Less
More
12 years 11 months ago - 12 years 11 months ago #57309
by ljk
SOLVED: K2 attachments was created by ljk
Hi,
We had a site that was running Joomla 1.5.24 and K2 2.4.1 in the root. We moved the site to a subfolder. Everything seems to be working with the exception of downloading attachements now. When you try to download an attachement you get a 404 error. It doesn't matter if it was an attachment setup before the site was moved to the folder or a new attachment that was made after the move, all attachment download requests result in a 404 error.
Does anyone know what is need to fix this problem?
Thank you.
We had a site that was running Joomla 1.5.24 and K2 2.4.1 in the root. We moved the site to a subfolder. Everything seems to be working with the exception of downloading attachements now. When you try to download an attachement you get a 404 error. It doesn't matter if it was an attachment setup before the site was moved to the folder or a new attachment that was made after the move, all attachment download requests result in a 404 error.
Does anyone know what is need to fix this problem?
Thank you.
Please Log in or Create an account to join the conversation.
- william white
- Offline
- Platinum Member
Less
More
- Posts: 3722
12 years 11 months ago #57310
by william white
Replied by william white on topic Re: K2 attachments
Only the filename with no path resides in the ***_k2_attachmens table in a field "filename"
There must be something that is getting the site root mixed up somewhere
I would try using a backup of the original site with akeeba and restoring the backup to the subdirectory using the installer and my bet is that it will work that way.. Havent tested this, but you may also find a setting in joomla global or php.ini that would fix this.
There must be something that is getting the site root mixed up somewhere
I would try using a backup of the original site with akeeba and restoring the backup to the subdirectory using the installer and my bet is that it will work that way.. Havent tested this, but you may also find a setting in joomla global or php.ini that would fix this.
Please Log in or Create an account to join the conversation.
- ljk
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 34
12 years 11 months ago #57311
by ljk
Replied by ljk on topic Re: K2 attachments
Hi,
Since there isn't an issue with paths anywhere else. My guess would be that the page for the attachement is starting with a / instead of just the path. So the code probably has /media/k2/attachements instead of media/k2/attachments. But I can't find where in the code the download path is being setup.
The link has this:But I can't find the code for task download.
The K2 parameters say that the default attachement folder is media/k2/attachements. I tried changing that to /subfolder/media/k2/attachements, subfolder/media/k2/attachements and media/k2/attachements but it didn't make any difference, I still got a 404 error each time I tried to download the attachment.
I tried adding var $livesite = http://domain/com/subfolder and that didn't make any difference either.
Can anyone confirm that running joomla in a subfolder, that K2 attachements work properly?
Thank you
Since there isn't an issue with paths anywhere else. My guess would be that the page for the attachement is starting with a / instead of just the path. So the code probably has /media/k2/attachements instead of media/k2/attachments. But I can't find where in the code the download path is being setup.
The link has this:
<a title="'.htmlentities($attachment->titleAttribute, ENT_QUOTES, 'UTF-8').'" href="'.JRoute::_('index.php?option=com_k2&view=item&task=download&id='.$attachment->id).'">'.$attachment->title.'</a>
The K2 parameters say that the default attachement folder is media/k2/attachements. I tried changing that to /subfolder/media/k2/attachements, subfolder/media/k2/attachements and media/k2/attachements but it didn't make any difference, I still got a 404 error each time I tried to download the attachment.
I tried adding var $livesite = http://domain/com/subfolder and that didn't make any difference either.
Can anyone confirm that running joomla in a subfolder, that K2 attachements work properly?
Thank you
Please Log in or Create an account to join the conversation.
- ljk
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 34
12 years 11 months ago - 12 years 11 months ago #57312
by ljk
Replied by ljk on topic Re: K2 attachments
Hi,
I found the problem, there was a space in the link instead of a ? in the item.php template file.
I found the problem, there was a space in the link instead of a ? in the item.php template file.
Please Log in or Create an account to join the conversation.
- Christophe BERTRAND
- Offline
- Senior Member
Less
More
- Posts: 46
12 years 11 months ago #57313
by Christophe BERTRAND
Replied by Christophe BERTRAND on topic Re: K2 attachments
Hi,
Got the same problem : I can't download the attachment, the link leads to a error 404 page.
Could you please explain your last post, where the error was between the space and the ?
Maybe could you post the working code, it would be great.
Aslo, I think my code looks a little bit different than yours :
<a title="<?php echo htmlentities($attachment->titleAttribute, ENT_QUOTES, 'UTF-8'); ?>" href="<?php echo JRoute::_('index.php?option=com_k2&view=item&task=download&id='.$attachment->id); ?>">
<?php echo $attachment->title ; ?>
</a>
Anyway, any suggestion would help.
Thanks.
Got the same problem : I can't download the attachment, the link leads to a error 404 page.
Could you please explain your last post, where the error was between the space and the ?
Maybe could you post the working code, it would be great.
Aslo, I think my code looks a little bit different than yours :
<a title="<?php echo htmlentities($attachment->titleAttribute, ENT_QUOTES, 'UTF-8'); ?>" href="<?php echo JRoute::_('index.php?option=com_k2&view=item&task=download&id='.$attachment->id); ?>">
<?php echo $attachment->title ; ?>
</a>
Anyway, any suggestion would help.
Thanks.
Please Log in or Create an account to join the conversation.
- Christophe BERTRAND
- Offline
- Senior Member
Less
More
- Posts: 46
12 years 11 months ago #57314
by Christophe BERTRAND
Replied by Christophe BERTRAND on topic Re: K2 attachments
Found this code on another post.
Works for me.
Here is the link if it can help others.
community.getk2.org/forum/topics/attachment-issue-with-svn?xg_browser=iphone
Works for me.
Here is the link if it can help others.
community.getk2.org/forum/topics/attachment-issue-with-svn?xg_browser=iphone
Please Log in or Create an account to join the conversation.
- Lance Thompson
- Offline
- New Member
- Making the Web Work For You
12 years 7 months ago #57315
by Lance Thompson
Lance Thompson - Blue Sky Web Worx
Web Design, SEO, Graphic Design
www.BlueSkyWebWorx.com
Replied by Lance Thompson on topic Re: K2 attachments
NOTE: Don't forget to change the code on your category_item.php IF you're showing downloads on that page as well.
Lance Thompson - Blue Sky Web Worx
Web Design, SEO, Graphic Design
www.BlueSkyWebWorx.com
Please Log in or Create an account to join the conversation.
- Jared Brandon
- Offline
- New Member
Less
More
- Posts: 4
12 years 6 months ago #57316
by Jared Brandon
Replied by Jared Brandon on topic Re: SOLVED: K2 attachments
I'm still having this same problem even after adjusting my item.php file. Here is my code after coping from the K2 component item.php to the template version:
Log in or Create an account to join the conversation.
- Aaron
- Offline
- Premium Member
12 years 6 months ago #57317
by Aaron
Aaron :)
Replied by Aaron on topic Re: SOLVED: K2 attachments
Check out the two posts below...
getk2.org/community/New-to-K2-Ask-here-first%21/9021-Re-Local-file-doesnt-exist#9021
and
getk2.org/community/New-to-K2-Ask-here-first%21/8700-files-moving-magically#8700
I am running in a subfolder as well... (btw, my problem was fixed)
Hope this helps!
getk2.org/community/New-to-K2-Ask-here-first%21/9021-Re-Local-file-doesnt-exist#9021
and
getk2.org/community/New-to-K2-Ask-here-first%21/8700-files-moving-magically#8700
I am running in a subfolder as well... (btw, my problem was fixed)
Hope this helps!
Aaron :)
Please Log in or Create an account to join the conversation.