Calling fopen and mkdir in Plugin

23 views
Skip to first unread message

RodF

unread,
Jun 16, 2011, 12:03:00 AM6/16/11
to Joomla! General Development
Hi all, I desperately need some help here. I have created a plugin to
import images into a Joomla shopping cart (Tienda). The php works
fine as a standalone file but when called from the component menu
errors on "mkdir" and "fopen" functions with the error:

fopen(images/com_tienda/products/21/14.jpg) [function.fopen]: failed
to open stream: No such file or directory.

The error appears to refer to the php functions rather than the actual
file or directory being worked on.

Azamat Tokhtaev

unread,
Jun 16, 2011, 12:06:34 AM6/16/11
to joomla-de...@googlegroups.com
This looks more like that the path is incorrect, try using the absolute path
example:

fopen(JPATH_ROOT.DS.'images'.DS.'com_tienda'.DS.'products'.DS.'21'.DS.'14.jpg');


--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.




--
Life Be Good mon

Gunjan Patel

unread,
Jun 16, 2011, 12:27:17 AM6/16/11
to Joomla! General Development
Hello RodF,

You can not use relative path in plugin ( You can only use in your
component where you know directory path ) because generally plugin can
load on every page of site.

We can not assume relative path. This is the reason you need to use
absolute path or live path.

Rod Farrell

unread,
Jun 16, 2011, 12:51:12 AM6/16/11
to joomla-de...@googlegroups.com
Thanks Azamat, that solved my problem.

I was previously calling the php from a content page so the relative path worked fine.

kind regards

Rod Farrell
--
Rod Farrell
Websites With Purpose

ABN 95769808144
www.websiteswithpurpose.com.au

0414 909 759

~ Website Design ~ Website Development ~ SEO ~ Website Hosting ~ eCommerce ~

Confidentiality: This e-mail and its attachments are intended for the above name only and are confidential. If you are not the intended addressee, or the person responsible for delivering it to the intended addressee, you may not copy or deliver it to anyone else or use it in any unauthorised manner. To do so is prohibited and may be unlawful. If you receive this email by mistake, advise the sender immediately by using the reply facility in your email software.
Reply all
Reply to author
Forward
0 new messages