Re: Re: move_uploaded_file() problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



make sure the permissions on the folders are right, so at least read for the
httpd in the tmp folder and write in the destination folder. since its
moving i would make them both writeable to the webserver daemon user.
permissions can be annoying are necessary though...
They caught me quite a few times now, so its one of the first things i would
check.

Tim-Hinnerk Heuer

http://www.ihostnz.com
Charles M. Schulz  - "I love mankind; it's people I can't stand."

2009/2/8 Alpár Török <torokalpar@xxxxxxxxx>

> 2009/2/7 Dušan Novaković <ndusan@xxxxxxxxx>
>
> > On Sat, Feb 7, 2009 at 12:29 PM, Alpár Török <torokalpar@xxxxxxxxx>
> wrote:
> > >
> > >
> > > 2009/2/7 Dušan Novaković <ndusan@xxxxxxxxx>
> > >>
> > >> Hi,
> > >>
> > >> I'm having problem with function move_uploaded_file() under Linux
> > >> (Slackware 12.2). It  simply won't execute only that function in php
> > >> file. So maybe I should add something to http.config file or .... ? I
> > >> tried to execute that php file under Windows and it's working just
> > >> fine (I've copied whole project to xampp's htdocs folder and run it
> > >> normally).
> > >
> > > Can you show some code?
> >
> > This is part where I use function move_uploaded_file()
> >
> > if($_FILES['file']['name'] && $_FILES['file']['size']<550000){
> >
> >                                                $file_name =
> > "news_".$_FILES['file']['name'];
> >
> >  $image="../_img/news/".$file_name;
> >                                                //Upload file
> >
> >  move_uploaded_file($_FILES['file']['tmp_name'], $image);
> >
> >                                                ....
> > }
> >
> >
> > And normaly HTML code:
> >
> Make sure that the relative path resolves to what you think it does. Try to
> make a test with a hard coded absolute path, and do an echo
> realpath("../_img/news/$file_name"); to see the absolute path that it
> resolves to. It might be that the function does indeed work, but places
> files in annother folder than you expect it to.
>
> >
> >
> > ....
> > <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"
> > enctype="multipart/form-data" name="form" id="form">
> >
> > ...
> >
> > <p><br>
> >          Slika [max 500kB; formati: gif, jpg, jpeg]:
> >        <input name="file" type="file" size="50" >
> >      </p>
> > .....
> >
> > >>
> > >>
> > >> And also I have question, does anyone knows how to configure apache
> > >> (also under same Linux) so that in future I woul
> > >>
> > >> dn't have to write
> > >> <?php but only <? every time I start php code?
> > >
> > > You need to change the enable_short_tags  directive. It is probably
> more
> > > simple to do it in the php.ini configuration file and not in the apache
> > > configuration file, but you should know that short tags are off by
> > default
> > > because they conflict with xml.
> > >>
> > >> Thnx, Dusan
> > >>
> > >> On Sat, Feb 7, 2009 at 11:53 AM, Dušan Novaković <ndusan@xxxxxxxxx>
> > wrote:
> > >> > Hi,
> > >> >
> > >> > I'm having problem with function move_uploaded_file() under Linux
> > >> > (Slackware 12.2). It  simply want execute only that function in php
> > >> > file. So maybe I should add something to http.config file or .... ?
> I
> > >> > tried to execute that php file under Windows and it's working just
> > >> > fine (I've copied whole project to xampp's htdocs folder and run it
> > >> > normally).
> > >> >
> > >> > And also I have question, does anyone knows how to configure apache
> > >> > (also under same Linux) so that in future I wouldn't have to write
> > >> > <?php but only <? every time I start php code?
> > >> >
> > >> > Thnx, Dusan
> > >> >
> > >> > --
> > >> > made by Dusan
> > >> >
> > >>
> > >>
> > >>
> > >> --
> > >> made by Dusan
> > >>
> > >> --
> > >> PHP General Mailing List (http://www.php.net/)
> > >> To unsubscribe, visit: http://www.php.net/unsub.php
> > >>
> > >
> > >
> > >
> > > --
> > > Alpar Torok
> > >
> >
> >
> >
> > --
> > made by Dusan
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> Alpar Torok
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux