[PHP] Help with file upload
This is the new code: ?php if (is_uploaded_file($_FILES['ufile1']['tmp_name'])) { copy($_FILES['ufile1']['tmp_name'], .); echo $ufile1_name ; echo DONE; echo ; print_r($_FILES); } else { echo Possible file upload attack. Filename: . $_FILES['ufile1']['name']; echo ; print_r($_FILES); } ? Bunmi Bunmi Akinmboni wrote: Thanks John, I had done it before and still tried it again now. This is what I get: Warning: copy(.): failed to open stream: Is a directory in /home/ayserve/public_html/fu/fuprocess.php on line 6 ayservenet.jpg DONE Array ( [ufile1] = Array ( [name] = ayservenet.jpg [type] = image/pjpeg [tmp_name] = /tmp/php1tARiu [error] = 0 [size] = 3030 ) ) Bunmi John W. Holmes wrote: Bunmi Akinmboni wrote: 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 got was: Possible 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(). -- '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: [EMAIL PROTECTED] Web site: http://www.budelak.com http://www.ayserve.net Web Design, Web Hosting, Domain Registration, ICT Consultancy, Networking, Internet, eCommerce, System Integrator === -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with file upload
Your webserver needs write permission to the directory where you want to copy. Bunmi Akinmboni wrote: This is the new code: ?php if (is_uploaded_file($_FILES['ufile1']['tmp_name'])) { copy($_FILES['ufile1']['tmp_name'], .); echo $ufile1_name ; echo DONE; echo ; print_r($_FILES); } else { echo Possible file upload attack. Filename: . $_FILES['ufile1']['name']; echo ; print_r($_FILES); } ? Bunmi Bunmi Akinmboni wrote: Thanks John, I had done it before and still tried it again now. This is what I get: Warning: copy(.): failed to open stream: Is a directory in /home/ayserve/public_html/fu/fuprocess.php on line 6 ayservenet.jpg DONE Array ( [ufile1] = Array ( [name] = ayservenet.jpg [type] = image/pjpeg [tmp_name] = /tmp/php1tARiu [error] = 0 [size] = 3030 ) ) Bunmi John W. Holmes wrote: Bunmi Akinmboni wrote: 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 got was: Possible 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(). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with file upload
- Original Message - From: Bunmi Akinmboni [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 16, 2003 1:33 PM Subject: [PHP] Help with file upload This is the new code: ?php if (is_uploaded_file($_FILES['ufile1']['tmp_name'])) { copy($_FILES['ufile1']['tmp_name'], .); i guess, actual problem is something like:: copy($_FILES['ufile1']['tmp_name'], .); while it should be copy($_FILES['ufile1']['tmp_name'], ./); hope it helps echo $ufile1_name ; echo DONE; echo ; print_r($_FILES); } else { echo Possible file upload attack. Filename: . $_FILES['ufile1']['name']; echo ; print_r($_FILES); } ? Bunmi Bunmi Akinmboni wrote: Thanks John, I had done it before and still tried it again now. This is what I get: Warning: copy(.): failed to open stream: Is a directory in /home/ayserve/public_html/fu/fuprocess.php on line 6 ayservenet.jpg DONE Array ( [ufile1] = Array ( [name] = ayservenet.jpg [type] = image/pjpeg [tmp_name] = /tmp/php1tARiu [error] = 0 [size] = 3030 ) ) Bunmi John W. Holmes wrote: Bunmi Akinmboni wrote: 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 got was: Possible 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(). -- '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: [EMAIL PROTECTED] Web site: http://www.budelak.com http://www.ayserve.net Web Design, Web Hosting, Domain Registration, ICT Consultancy, Networking, Internet, eCommerce, System Integrator === -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php