Re: Help with file upload
| From: | Bunmi Akinmboni | Date: | Thu, 16 Oct 2003 07:51:33 +0000 |
| Subject: | Re: Help with file upload | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-31058@lists.php.net to get a copy of this message | ||
I just changed the permission on fu folder to 777 but it gives me the same problem. I'm writing this script so that I can use it to upload to jpeg files. The code is hereby attached.
Gabriel Peugnet wrote:
For the message:-- 'Bunmi Akinmboni 5, Aibu Street, Off Bode Thomas Street, P.O. Box 6235, Surulere, Lagos, NIGERIA. Tel: (234) 1-813-3335 Fax: (234) 1-583-2585 (Nigeria Only) Fax: 1 (309) 285-2383 (International) Email: bunmi.akinmboni@ayserve.net Web site: http://www.budelak.com http://www.ayserve.net Web Design, Web Hosting, Domain Registration, ICT Consultancy, Networking, Internet, eCommerce, System Integrator ===================================================Warning: move_uploaded_file(./ayservenet.jpg): failed to open stream: Permission denied in /home/ayserve/public_html/fu/fuprocess.php on line 6you have to change the permissions of the file folder where you are copying the file. If you created it via FTP then you can't use copy() or move(). check: echo fileperms( $folder ); if it's 33188 or 33279 it's ok but I think it is not the permission of your folder. I think you'll get 17901 or some other. so you have to use ftp_chmod() of ftp_site() to change it.. try this:$folderbase = "folderbase"; // it's the folder where your folder foruploads is.$folder = "foldername"; // it's your folder for uploads.$mode = "0777"; $site = ftp_connect ( "ftp.yourdomain.com" );if( $site != FALSE ) {$loged = ftp_login( $site , "your username", "your password" );if( $loged ) {ftp_chdir( $site , $folder ); ftp_site( $site , "chmod $mode $folder" );}ftp_quit( $site ); "John W. Holmes" <holmes072000@charter.net> escribió en el mensaje news:3F8E1F4E.1040809@charter.net...Bunmi Akinmboni wrote:was:Pls Help. I have done a lot of reading prior to this yet I just can't seem make it work. I wrote an upload program as seen below but the response I gotPossible file upload attack. Filename: ayservenet.jpg Array ( [ufile1] => Array ( [name] => ayservenet.jpg [type] => image/pjpeg [tmp_name] => /tmp/phpIMEhdh [error] => 0 [size] => 3030 ) )[snip]if (is_uploaded_file($_FILES['ufile1']['name'])) { copy($_FILES['ufile1']['name'], "."); echo "$ufile1_name "; echo "DONE"; echo " "; print_r($_FILES); } else { echo "Possible file upload attack. Filename: " . $_FILES['ufile1']['name']; echo " "; print_r($_FILES); } ?>You should pass $_FILES['ufile1']['tmp_name'] to is_uploaded_file(). -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com