Re: [PHP] Browse and Upload file
Aha Yes, it works fine now. Again, thanks a lot. Rdb On Thursday 14 February 2002 12:18 am, you wrote: > On Wed, 2002-02-13 at 19:18, Reuben D Budiardja wrote: > > Yes, I have. I follow the example exactly from > > http://www.php.net/manual/en/features.file-upload.php. > > Well, that's the problem then. The example in the manual is buggy. :) > > > uploadPic2.php: > > > print_r($HTTP_POST_FILES); > > move_uploaded_file($HTTP_POST_FILES['userfile'], "/home/web/final"); > > The above line should read: > > move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'], >"/home/web/final/some_file_name.jpg"); > > > Hope this clears it up for you. > > Torben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browse and Upload file
On Wed, 2002-02-13 at 19:18, Reuben D Budiardja wrote: > Yes, I have. I follow the example exactly from > http://www.php.net/manual/en/features.file-upload.php. Well, that's the problem then. The example in the manual is buggy. :) This was fixed in cvs earlier today, actually, but the online manual hasn't been regenerated yet, so it hasn't shown up online. It'll be visible (meaning the correct example) within a few days. See below... > Here is my scripts: > > uploadPic.php: > > > > > Send this file: > > > > > > uploadPic2.php: > print_r($HTTP_POST_FILES); > move_uploaded_file($HTTP_POST_FILES['userfile'], "/home/web/final"); The above line should read: move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'], "/home/web/final/some_file_name.jpg"); Hope this clears it up for you. Torben > ?> > > Thanks a lot for helping me. > Reuben D. Budiardja > > > -- Torben Wilson <[EMAIL PROTECTED]> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browse and Upload file
On Wednesday 13 February 2002 09:57 pm, you wrote: > On Wed, 2002-02-13 at 18:53, Reuben D Budiardja wrote: > > print_r $HTTP_POST_FILE gives me: > > > > Array ( [userfile] => Array ( [name] => timecard.png [type] => image/png > > [tmp_name] => /home/web/phpZKBTak [size] => 38656 ) ) > > > > But I still can't find the file at /home/web/. > > > > Thanks for your help. > > Reuben D. Budiardja > > You need to move the temp file to whereever its final resting place > is. i.e. have you done a move_upload_file() on it yet? Yes, I have. I follow the example exactly from http://www.php.net/manual/en/features.file-upload.php. Here is my scripts: uploadPic.php: Send this file: uploadPic2.php: Thanks a lot for helping me. Reuben D. Budiardja -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browse and Upload file
On Wed, 2002-02-13 at 18:53, Reuben D Budiardja wrote: > Sorry, I meant to include those information. > > Here is from php.ini > > ; File Uploads ; > > file_uploads = On; Whether to allow HTTP file uploads > upload_tmp_dir = /home/web > upload_max_filesize = 2M; Maximum allowed size for uploaded files > > PHP Version 4.0.6 > > One stupid mistake I made was that I put the wrong size for MAX_FILE_SIZE, > but I fixed it now. print_r $HTTP_POST_FILE gives me: > > Array ( [userfile] => Array ( [name] => timecard.png [type] => image/png > [tmp_name] => /home/web/phpZKBTak [size] => 38656 ) ) > > But I still can't find the file at /home/web/. > > Thanks for your help. > Reuben D. Budiardja You need to move the temp file to whereever its final resting place is. i.e. have you done a move_upload_file() on it yet? -- Torben Wilson <[EMAIL PROTECTED]> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browse and Upload file
Sorry, I meant to include those information. Here is from php.ini ; File Uploads ; file_uploads = On; Whether to allow HTTP file uploads upload_tmp_dir = /home/web upload_max_filesize = 2M; Maximum allowed size for uploaded files PHP Version 4.0.6 One stupid mistake I made was that I put the wrong size for MAX_FILE_SIZE, but I fixed it now. print_r $HTTP_POST_FILE gives me: Array ( [userfile] => Array ( [name] => timecard.png [type] => image/png [tmp_name] => /home/web/phpZKBTak [size] => 38656 ) ) But I still can't find the file at /home/web/. Thanks for your help. Reuben D. Budiardja On Wednesday 13 February 2002 09:31 pm, Lars Torben Wilson wrote: > On Wed, 2002-02-13 at 18:26, Reuben D Budiardja wrote: > > Thanks. I follow the manual. I changed my php.ini: > > upload_tmp_dir = '/home/web/' > > which is writable by web (the user running apache/php) and restart > > apache. > > > > However, after I upload the file, I can't find it. When I do > > print_r($HTTP_POST_FILE), here is what I got: > > > > Array ( [userfile] => Array ( [name] => timecard.png [type] => image/png > > [tmp_name] => none [size] => 0 ) ) > > > > You see that [tmp_name] is none (whatever that means), and size is zero. > > why is that? > > The webserver and the browser is on local LAN, and there is no firewall. > > > > Thanks for any help. > > Reuben D. Budiardja > > First, check that the file size is less than the max upload size set in > php.ini and/or the upload form. > > Second, what version of PHP are you running? -- -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ "God is the unrestricted act of understanding, the eternal rapture glimpsed in every Archimedean cry of Eureka." - Bernard Lonergan - ~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^ Reuben Donald Budiardja [EMAIL PROTECTED] Homepage: http://www.goshen.edu/~reubendb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browse and Upload file
On Wed, 2002-02-13 at 18:26, Reuben D Budiardja wrote: > Thanks. I follow the manual. I changed my php.ini: > upload_tmp_dir = '/home/web/' > which is writable by web (the user running apache/php) and restart apache. > > However, after I upload the file, I can't find it. When I do > print_r($HTTP_POST_FILE), here is what I got: > > Array ( [userfile] => Array ( [name] => timecard.png [type] => image/png > [tmp_name] => none [size] => 0 ) ) > > You see that [tmp_name] is none (whatever that means), and size is zero. > why is that? > The webserver and the browser is on local LAN, and there is no firewall. > > Thanks for any help. > Reuben D. Budiardja First, check that the file size is less than the max upload size set in php.ini and/or the upload form. Second, what version of PHP are you running? -- Torben Wilson <[EMAIL PROTECTED]> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browse and Upload file
Thanks. I follow the manual. I changed my php.ini: upload_tmp_dir = '/home/web/' which is writable by web (the user running apache/php) and restart apache. However, after I upload the file, I can't find it. When I do print_r($HTTP_POST_FILE), here is what I got: Array ( [userfile] => Array ( [name] => timecard.png [type] => image/png [tmp_name] => none [size] => 0 ) ) You see that [tmp_name] is none (whatever that means), and size is zero. why is that? The webserver and the browser is on local LAN, and there is no firewall. Thanks for any help. Reuben D. Budiardja On Wednesday 13 February 2002 08:38 pm, Lars Torben Wilson wrote: > On Wed, 2002-02-13 at 17:38, Reuben D Budiardja wrote: > > Hi, > > Does anyone know how to upload file using Web Browser as the interface? > > > An excellent starting point is the manual section on this topic: > > http://www.php.net/manual/en/features.file-upload.php > > It is fully explained there, with examples. > > > Hope this helps, > > Torben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browse and Upload file
On Wed, 2002-02-13 at 17:38, Reuben D Budiardja wrote: > > Hi, > Does anyone know how to upload file using Web Browser as the interface? > > I want to do a web page, where you can click on a button, and then you can > browse the local directories of the person who are browsing the page, and > upload a selected file to the web server. Any pointer on how to do that will > be greatly appreciated. > > Thanks. > Reuben D. Budiardja An excellent starting point is the manual section on this topic: http://www.php.net/manual/en/features.file-upload.php It is fully explained there, with examples. Hope this helps, Torben -- Torben Wilson <[EMAIL PROTECTED]> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Browse and Upload file
Hi, Does anyone know how to upload file using Web Browser as the interface? I want to do a web page, where you can click on a button, and then you can browse the local directories of the person who are browsing the page, and upload a selected file to the web server. Any pointer on how to do that will be greatly appreciated. Thanks. Reuben D. Budiardja -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php