[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    Re: [PHP] Writing a file from a Sub-Domain form to Upper Domain
From:       Stuart Dallas <stuart () 3ft9 ! com>
Date:       2014-08-20 18:08:22
Message-ID: CAJgGj58KUyRU9L3RrsE9Md_StUCuhayNyK_p-AxzWegpkDqhPg () mail ! gmail ! com
[Download RAW message or body]


On 20 August 2014 19:04, Don Wieland <donw@dwdataconcepts.com> wrote:

> On Aug 20, 2014, at 10:56 AM, Stuart Dallas wrote:
>
> > My bad. Add a / before the first .. on that line:
> >
> >  $directory = dirname(__FILE__).'/../../../media/images/';
> >
> > However, from that error message you can see the full path that will be
> generated:
> >
> >
> /home/rtsadven/public_html/wrightcheck/admin/resources/php/../../../media/images/pic2.jpg
> >
> > Or, normalised:
> >
> > /home/rtsadven/public_html/wrightcheck/media/images/pic2.jpg
> >
> > Is that the right path?
>
> Bingo - that is the correct path and the image was moved correctly. Thanks
> Stuart and everyone else who chimed in on this. Great list!!!


Good stuff. For future reference it's generally a really bad idea to rely
on assuming what the current directory will be, so you should always base
directories off a known point such as the directory of the current script
[dirname(__FILE__) or __DIR__ in 5.3+] or a globally defined absolute
directory [which should also ideally come from dirname() or __DIR__].

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic