Re: Re: move_uploaded_file() problem

From: Date: Sat, 07 Feb 2009 13:58:23 +0000
Subject: Re: Re: move_uploaded_file() problem
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-287900@lists.php.net to get a copy of this message
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@gmail.com> > 2009/2/7 Dušan Novaković <ndusan@gmail.com> > > > On Sat, Feb 7, 2009 at 12:29 PM, Alpár Török <torokalpar@gmail.com> > wrote: > > > > > > > > > 2009/2/7 Dušan Novaković <ndusan@gmail.com> > > >> > > >> 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@gmail.com> > > 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 >

« previous php.general (#287900) next »