PHP-file upload problem and upload_tmp_dir

This is a discussion on PHP-file upload problem and upload_tmp_dir within the PHP Language forums, part of the PHP Programming Forums category; mike wrote: > Jerry Stuckle wrote: >> mike wrote: >> >>> Jerry Stuckle wrote: >>&...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 03-08-2008
Jerry Stuckle
 
Posts: n/a
Default Re: PHP-file upload problem and upload_tmp_dir

mike wrote:
> Jerry Stuckle wrote:
>> mike wrote:
>>
>>> Jerry Stuckle wrote:
>>>
>>>> mike wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> I am new and trying to learn php. I am trying to use some of the
>>>>> scripts in the php manual (http://www.php.net/manual/en/) to upload
>>>>> a file. I can not seem to get the file to upload. Actually I am
>>>>> "uploading" to the same windows XP computer, trying to move the
>>>>> file from one directory to another. It appears that the file is
>>>>> suppose to be passed to a temporary file in a temporary directory.
>>>>> I think this is where I am having trouble. The form script seems to
>>>>> get the file correctly. It calls and posts to the file processing
>>>>> script correctly. But the file
>>>>> processing script fails. I get error 6 which is "Missing a
>>>>> temporary folder." (see below for complete scripts and outputs)
>>>>>
>>>>> If I do a phpinfo() call I see that upload_tmp_dir is not set
>>>>> if I do $a=ini_get('upload_tmp_dir'); and echo $a I get NULL.
>>>>>
>>>>> The manual says that 'upload_tmp_dir' is set in php.ini. I found
>>>>> php.ini in the Program Files/php/ directory. I find the variable set
>>>>> in 2 places in that file:
>>>>>
>>>>> ******
>>>>> .
>>>>> .
>>>>> .
>>>>> ; Whether to allow HTTP file uploads.
>>>>> file_uploads = On
>>>>>
>>>>> ; Temporary directory for HTTP uploaded files (will use system
>>>>> default ;if not
>>>>> ; specified).
>>>>> ;upload_tmp_dir =
>>>>> .
>>>>> .
>>>>> .
>>>>> ; Default timeout for socket based streams (seconds)
>>>>> default_socket_timeout = 60
>>>>> upload_tmp_dir="C:\DOCUME~1\MIA-KI~1\LOCALS~1\Temp\php\upload"
>>>>> session.save_path="C:\DOCUME~1\MIA-KI~1\LOCALS~1\Temp\php\session"
>>>>> .
>>>>> .
>>>>> .
>>>>> *********
>>>>> The directory set in the 2nd instance:
>>>>>
>>>>> upload_tmp_dir="C:\DOCUME~1\MIA-KI~1\LOCALS~1\Temp\php\upload"
>>>>>
>>>>> exists on my pc, however, phpinfo() says 'upload_tmp_dir' is not set.
>>>>>
>>>>> If I uncomment the 1st instance and set it:
>>>>>
>>>>> upload_tmp_dir ="C:\tempphp" (a directory which I have created)
>>>>>
>>>>> phpinfo() reports 'upload_tmp_dir' is not set.
>>>>>
>>>>> I have tried puting the php.ini file in my wwwroot directory and in
>>>>> the working directory containing the scripts (I think this is where
>>>>> it should be) and still phpinfo() reports 'upload_tmp_dir' is not set.
>>>>>
>>>>> I have also tried ini_set('upload_tmp_dir', 'C:\tempphp');
>>>>> that also does not work.
>>>>>
>>>>> *********************************************
>>>>> Q1: How do I set the temporary upload file 'upload_tmp_dir' in
>>>>> windows XP.
>>>>>
>>>>> Q2: Once I have set 'upload_tmp_dir' how do I know the temproary
>>>>> file name 'tmp_name' that php uses to hold that file before it gets
>>>>> moved using:
>>>>>
>>>>> move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)
>>>>>
>>>>> Thank You
>>>>> Mike
>>>>>
>>>>>
>>>>>
>>>>> ********************************************
>>>>> I use the following to generate a form to get the file name:
>>>>> *****
>>>>>
>>>>> <!-- The data encoding type, enctype, MUST be specified as below -->
>>>>> <form enctype="multipart/form-data"
>>>>> action="http://localhost/php/upload.php" method="POST">
>>>>> <!-- MAX_FILE_SIZE must precede the file input field -->
>>>>> <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
>>>>> <!-- Name of input element determines name in $_FILES array -->
>>>>> Send this file: <input name="userfile" type="file" />
>>>>> <input type="submit" value="Send File" />
>>>>> </form>
>>>>> <h1> hello world</h1>
>>>>> </body>
>>>>> </html>
>>>>>
>>>>> ******************************************
>>>>> Then I use the following php script
>>>>> (http://localhost/php/upload.php) to do the moving:
>>>>> ******
>>>>>
>>>>> <html>
>>>>> <body>
>>>>> <?php
>>>>> // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be
>>>>> used instead
>>>>> // of $_FILES.
>>>>>
>>>>> $uploaddir = './upload/';
>>>>> $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
>>>>>
>>>>> echo '<pre>';
>>>>> if (move_uploaded_file($_FILES['userfile']['tmp_name'],
>>>>> $uploadfile)) {
>>>>> echo "File is valid, and was successfully uploaded.\n";
>>>>> } else {
>>>>> echo "Possible file upload problem\n";
>>>>> }
>>>>>
>>>>> echo 'Here is some more debugging info:';
>>>>> print_r($_FILES);
>>>>>
>>>>> print "</pre>";
>>>>>
>>>>> ?>
>>>>> </body>
>>>>> </html>
>>>>> ***********************************
>>>>>
>>>>> I get the following output:
>>>>>
>>>>> *******
>>>>>
>>>>> Possible file upload problem
>>>>> Here is some more debugging info:Array
>>>>> (
>>>>> [userfile] => Array
>>>>> (
>>>>> [name] => usage_rights.txt
>>>>> [type] =>
>>>>> [tmp_name] =>
>>>>> [error] => 6
>>>>> [size] => 0
>>>>> )
>>>>>
>>>>> )
>>>>>
>>>>
>>>> The first question is - which configuration file does phpino() say
>>>> it's using?
>>>>
>>>
>>> Hi Jerry,
>>>
>>> Configuration File (php.ini) Path C:\WINDOWS
>>>
>>> however when I look in the windows directory there is no php.ini file.
>>>
>>> Mike
>>>

>>
>> OK, so it's using a default file. The easiest way right now to change
>> that is to put your php.ini file in c:/windows.
>>

> OK I placed the php.ini file in the c:/windows directory but phpino()
> still reports 'upload_tmp_dir' as unset. Do I need to stop and restart
> the IIS web server.
>
> Thanks
> mike
>


Of course. Why didn't you just try it instead of asking here?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Reply With Quote
  #12 (permalink)  
Old 03-08-2008
mike
 
Posts: n/a
Default Re: PHP-file upload problem and upload_tmp_dir

Jerry Stuckle wrote:
> mike wrote:
>
>> Jerry Stuckle wrote:
>>
>>> mike wrote:
>>>
>>>> Jerry Stuckle wrote:
>>>>
>>>>> mike wrote:
>>>>>
>>>>>> Hi
>>>>>>
>>>>>> I am new and trying to learn php. I am trying to use some of the
>>>>>> scripts in the php manual (http://www.php.net/manual/en/) to
>>>>>> upload a file. I can not seem to get the file to upload. Actually
>>>>>> I am "uploading" to the same windows XP computer, trying to move
>>>>>> the file from one directory to another. It appears that the file
>>>>>> is suppose to be passed to a temporary file in a temporary
>>>>>> directory. I think this is where I am having trouble. The form
>>>>>> script seems to get the file correctly. It calls and posts to the
>>>>>> file processing script correctly. But the file
>>>>>> processing script fails. I get error 6 which is "Missing a
>>>>>> temporary folder." (see below for complete scripts and outputs)
>>>>>>
>>>>>> If I do a phpinfo() call I see that upload_tmp_dir is not set
>>>>>> if I do $a=ini_get('upload_tmp_dir'); and echo $a I get NULL.
>>>>>>
>>>>>> The manual says that 'upload_tmp_dir' is set in php.ini. I found
>>>>>> php.ini in the Program Files/php/ directory. I find the variable set
>>>>>> in 2 places in that file:
>>>>>>
>>>>>> ******
>>>>>> .
>>>>>> .
>>>>>> .
>>>>>> ; Whether to allow HTTP file uploads.
>>>>>> file_uploads = On
>>>>>>
>>>>>> ; Temporary directory for HTTP uploaded files (will use system
>>>>>> default ;if not
>>>>>> ; specified).
>>>>>> ;upload_tmp_dir =
>>>>>> .
>>>>>> .
>>>>>> .
>>>>>> ; Default timeout for socket based streams (seconds)
>>>>>> default_socket_timeout = 60
>>>>>> upload_tmp_dir="C:\DOCUME~1\MIA-KI~1\LOCALS~1\Temp\php\upload"
>>>>>> session.save_path="C:\DOCUME~1\MIA-KI~1\LOCALS~1\Temp\php\session"
>>>>>> .
>>>>>> .
>>>>>> .
>>>>>> *********
>>>>>> The directory set in the 2nd instance:
>>>>>>
>>>>>> upload_tmp_dir="C:\DOCUME~1\MIA-KI~1\LOCALS~1\Temp\php\upload"
>>>>>>
>>>>>> exists on my pc, however, phpinfo() says 'upload_tmp_dir' is not set.
>>>>>>
>>>>>> If I uncomment the 1st instance and set it:
>>>>>>
>>>>>> upload_tmp_dir ="C:\tempphp" (a directory which I have created)
>>>>>>
>>>>>> phpinfo() reports 'upload_tmp_dir' is not set.
>>>>>>
>>>>>> I have tried puting the php.ini file in my wwwroot directory and in
>>>>>> the working directory containing the scripts (I think this is
>>>>>> where it should be) and still phpinfo() reports 'upload_tmp_dir'
>>>>>> is not set.
>>>>>>
>>>>>> I have also tried ini_set('upload_tmp_dir', 'C:\tempphp');
>>>>>> that also does not work.
>>>>>>
>>>>>> *********************************************
>>>>>> Q1: How do I set the temporary upload file 'upload_tmp_dir' in
>>>>>> windows XP.
>>>>>>
>>>>>> Q2: Once I have set 'upload_tmp_dir' how do I know the temproary
>>>>>> file name 'tmp_name' that php uses to hold that file before it
>>>>>> gets moved using:
>>>>>>
>>>>>> move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)
>>>>>>
>>>>>> Thank You
>>>>>> Mike
>>>>>>
>>>>>>
>>>>>>
>>>>>> ********************************************
>>>>>> I use the following to generate a form to get the file name:
>>>>>> *****
>>>>>>
>>>>>> <!-- The data encoding type, enctype, MUST be specified as below -->
>>>>>> <form enctype="multipart/form-data"
>>>>>> action="http://localhost/php/upload.php" method="POST">
>>>>>> <!-- MAX_FILE_SIZE must precede the file input field -->
>>>>>> <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
>>>>>> <!-- Name of input element determines name in $_FILES array -->
>>>>>> Send this file: <input name="userfile" type="file" />
>>>>>> <input type="submit" value="Send File" />
>>>>>> </form>
>>>>>> <h1> hello world</h1>
>>>>>> </body>
>>>>>> </html>
>>>>>>
>>>>>> ******************************************
>>>>>> Then I use the following php script
>>>>>> (http://localhost/php/upload.php) to do the moving:
>>>>>> ******
>>>>>>
>>>>>> <html>
>>>>>> <body>
>>>>>> <?php
>>>>>> // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be
>>>>>> used instead
>>>>>> // of $_FILES.
>>>>>>
>>>>>> $uploaddir = './upload/';
>>>>>> $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
>>>>>>
>>>>>> echo '<pre>';
>>>>>> if (move_uploaded_file($_FILES['userfile']['tmp_name'],
>>>>>> $uploadfile)) {
>>>>>> echo "File is valid, and was successfully uploaded.\n";
>>>>>> } else {
>>>>>> echo "Possible file upload problem\n";
>>>>>> }
>>>>>>
>>>>>> echo 'Here is some more debugging info:';
>>>>>> print_r($_FILES);
>>>>>>
>>>>>> print "</pre>";
>>>>>>
>>>>>> ?>
>>>>>> </body>
>>>>>> </html>
>>>>>> ***********************************
>>>>>>
>>>>>> I get the following output:
>>>>>>
>>>>>> *******
>>>>>>
>>>>>> Possible file upload problem
>>>>>> Here is some more debugging info:Array
>>>>>> (
>>>>>> [userfile] => Array
>>>>>> (
>>>>>> [name] => usage_rights.txt
>>>>>> [type] =>
>>>>>> [tmp_name] =>
>>>>>> [error] => 6
>>>>>> [size] => 0
>>>>>> )
>>>>>>
>>>>>> )
>>>>>>
>>>>>
>>>>> The first question is - which configuration file does phpino() say
>>>>> it's using?
>>>>>
>>>>
>>>> Hi Jerry,
>>>>
>>>> Configuration File (php.ini) Path C:\WINDOWS
>>>>
>>>> however when I look in the windows directory there is no php.ini file.
>>>>
>>>> Mike
>>>>
>>>
>>> OK, so it's using a default file. The easiest way right now to
>>> change that is to put your php.ini file in c:/windows.
>>>

>> OK I placed the php.ini file in the c:/windows directory but phpino()
>> still reports 'upload_tmp_dir' as unset. Do I need to stop and restart
>> the IIS web server.
>>
>> Thanks
>> mike
>>

>
> Of course. Why didn't you just try it instead of asking here?
>

Ok stopped and started the server. phpino() still reports
'upload_tmp_dir' as unset.

Mike
Reply With Quote
  #13 (permalink)  
Old 03-08-2008
mike
 
Posts: n/a
Default Re: PHP-file upload problem and upload_tmp_dir

Jerry Stuckle wrote:
> mike wrote:
>
>> Jerry Stuckle wrote:
>>
>>> mike wrote:
>>>
>>>> Jerry Stuckle wrote:
>>>>
>>>>> mike wrote:
>>>>>
>>>>>> Hi
>>>>>>
>>>>>> I am new and trying to learn php. I am trying to use some of the
>>>>>> scripts in the php manual (http://www.php.net/manual/en/) to
>>>>>> upload a file. I can not seem to get the file to upload. Actually
>>>>>> I am "uploading" to the same windows XP computer, trying to move
>>>>>> the file from one directory to another. It appears that the file
>>>>>> is suppose to be passed to a temporary file in a temporary
>>>>>> directory. I think this is where I am having trouble. The form
>>>>>> script seems to get the file correctly. It calls and posts to the
>>>>>> file processing script correctly. But the file
>>>>>> processing script fails. I get error 6 which is "Missing a
>>>>>> temporary folder." (see below for complete scripts and outputs)
>>>>>>
>>>>>> If I do a phpinfo() call I see that upload_tmp_dir is not set
>>>>>> if I do $a=ini_get('upload_tmp_dir'); and echo $a I get NULL.
>>>>>>
>>>>>> The manual says that 'upload_tmp_dir' is set in php.ini. I found
>>>>>> php.ini in the Program Files/php/ directory. I find the variable set
>>>>>> in 2 places in that file:
>>>>>>
>>>>>> ******
>>>>>> .
>>>>>> .
>>>>>> .
>>>>>> ; Whether to allow HTTP file uploads.
>>>>>> file_uploads = On
>>>>>>
>>>>>> ; Temporary directory for HTTP uploaded files (will use system
>>>>>> default ;if not
>>>>>> ; specified).
>>>>>> ;upload_tmp_dir =
>>>>>> .
>>>>>> .
>>>>>> .
>>>>>> ; Default timeout for socket based streams (seconds)
>>>>>> default_socket_timeout = 60
>>>>>> upload_tmp_dir="C:\DOCUME~1\MIA-KI~1\LOCALS~1\Temp\php\upload"
>>>>>> session.save_path="C:\DOCUME~1\MIA-KI~1\LOCALS~1\Temp\php\session"
>>>>>> .
>>>>>> .
>>>>>> .
>>>>>> *********
>>>>>> The directory set in the 2nd instance:
>>>>>>
>>>>>> upload_tmp_dir="C:\DOCUME~1\MIA-KI~1\LOCALS~1\Temp\php\upload"
>>>>>>
>>>>>> exists on my pc, however, phpinfo() says 'upload_tmp_dir' is not set.
>>>>>>
>>>>>> If I uncomment the 1st instance and set it:
>>>>>>
>>>>>> upload_tmp_dir ="C:\tempphp" (a directory which I have created)
>>>>>>
>>>>>> phpinfo() reports 'upload_tmp_dir' is not set.
>>>>>>
>>>>>> I have tried puting the php.ini file in my wwwroot directory and in
>>>>>> the working directory containing the scripts (I think this is
>>>>>> where it should be) and still phpinfo() reports 'upload_tmp_dir'
>>>>>> is not set.
>>>>>>
>>>>>> I have also tried ini_set('upload_tmp_dir', 'C:\tempphp');
>>>>>> that also does not work.
>>>>>>
>>>>>> *********************************************
>>>>>> Q1: How do I set the temporary upload file 'upload_tmp_dir' in
>>>>>> windows XP.
>>>>>>
>>>>>> Q2: Once I have set 'upload_tmp_dir' how do I know the temproary
>>>>>> file name 'tmp_name' that php uses to hold that file before it
>>>>>> gets moved using:
>>>>>>
>>>>>> move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)
>>>>>>
>>>>>> Thank You
>>>>>> Mike
>>>>>>
>>>>>>
>>>>>>
>>>>>> ********************************************
>>>>>> I use the following to generate a form to get the file name:
>>>>>> *****
>>>>>>
>>>>>> <!-- The data encoding type, enctype, MUST be specified as below -->
>>>>>> <form enctype="multipart/form-data"
>>>>>> action="http://localhost/php/upload.php" method="POST">
>>>>>> <!-- MAX_FILE_SIZE must precede the file input field -->
>>>>>> <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
>>>>>> <!-- Name of input element determines name in $_FILES array -->
>>>>>> Send this file: <input name="userfile" type="file" />
>>>>>> <input type="submit" value="Send File" />
>>>>>> </form>
>>>>>> <h1> hello world</h1>
>>>>>> </body>
>>>>>> </html>
>>>>>>
>>>>>> ******************************************
>>>>>> Then I use the following php script
>>>>>> (http://localhost/php/upload.php) to do the moving:
>>>>>> ******
>>>>>>
>>>>>> <html>
>>>>>> <body>
>>>>>> <?php
>>>>>> // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be
>>>>>> used instead
>>>>>> // of $_FILES.
>>>>>>
>>>>>> $uploaddir = './upload/';
>>>>>> $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
>>>>>>
>>>>>> echo '<pre>';
>>>>>> if (move_uploaded_file($_FILES['userfile']['tmp_name'],
>>>>>> $uploadfile)) {
>>>>>> echo "File is valid, and was successfully uploaded.\n";
>>>>>> } else {
>>>>>> echo "Possible file upload problem\n";
>>>>>> }
>>>>>>
>>>>>> echo 'Here is some more debugging info:';
>>>>>> print_r($_FILES);
>>>>>>
>>>>>> print "</pre>";
>>>>>>
>>>>>> ?>
>>>>>> </body>
>>>>>> </html>
>>>>>> ***********************************
>>>>>>
>>>>>> I get the following output:
>>>>>>
>>>>>> *******
>>>>>>
>>>>>> Possible file upload problem
>>>>>> Here is some more debugging info:Array
>>>>>> (
>>>>>> [userfile] => Array
>>>>>> (
>>>>>> [name] => usage_rights.txt
>>>>>> [type] =>
>>>>>> [tmp_name] =>
>>>>>> [error] => 6
>>>>>> [size] => 0
>>>>>> )
>>>>>>
>>>>>> )
>>>>>>
>>>>>
>>>>> The first question is - which configuration file does phpino() say
>>>>> it's using?
>>>>>
>>>>
>>>> Hi Jerry,
>>>>
>>>> Configuration File (php.ini) Path C:\WINDOWS
>>>>
>>>> however when I look in the windows directory there is no php.ini file.
>>>>
>>>> Mike
>>>>
>>>
>>> OK, so it's using a default file. The easiest way right now to
>>> change that is to put your php.ini file in c:/windows.
>>>

>> OK I placed the php.ini file in the c:/windows directory but phpino()
>> still reports 'upload_tmp_dir' as unset. Do I need to stop and restart
>> the IIS web server.
>>
>> Thanks
>> mike
>>

>
> Of course. Why didn't you just try it instead of asking here?
>

Thanks for you help

mike
Reply With Quote
  #14 (permalink)  
Old 03-09-2008
Jeff North
 
Posts: n/a
Default Re: PHP-file upload problem and upload_tmp_dir

On Sat, 08 Mar 2008 11:11:16 -0800, in comp.lang.php mike
<spammesillt@junkmail.com>
<pxBAj.61849$Pv2.56757@newssvr23.news.prodigy.ne t> wrote:

>| Hi
>|
>| I am new and trying to learn php. I am trying to use some of the scripts
>| in the php manual (http://www.php.net/manual/en/) to upload a file. I
>| can not seem to get the file to upload. Actually I am "uploading" to the
>| same windows XP computer, trying to move the file from one directory to
>| another. It appears that the file is suppose to be passed to a temporary
>| file in a temporary directory. I think this is where I am having
>| trouble. The form script seems to get the file correctly. It calls and
>| posts to the file processing script correctly. But the file
>| processing script fails. I get error 6 which is "Missing a temporary
>| folder." (see below for complete scripts and outputs)
>|
>| If I do a phpinfo() call I see that upload_tmp_dir is not set
>| if I do $a=ini_get('upload_tmp_dir'); and echo $a I get NULL.
>|
>| The manual says that 'upload_tmp_dir' is set in php.ini. I found
>| php.ini in the Program Files/php/ directory. I find the variable set
>| in 2 places in that file:
>|
>| ******
>| .
>| .
>| .
>| ; Whether to allow HTTP file uploads.
>| file_uploads = On
>|
>| ; Temporary directory for HTTP uploaded files (will use system default
>| ;if not
>| ; specified).
>| ;upload_tmp_dir =
>| .
>| .
>| .
>| ; Default timeout for socket based streams (seconds)
>| default_socket_timeout = 60
>| upload_tmp_dir="C:\DOCUME~1\MIA-KI~1\LOCALS~1\Temp\php\upload"
>| session.save_path="C:\DOCUME~1\MIA-KI~1\LOCALS~1\Temp\php\session"


Use either forward slash / or double backslashes \\

upload_tmp_dir="C:/DOCUME~1/MIA-KI~1/LOCALS~1/Temp/php/upload"
upload_tmp_dir="C:\\DOCUME~1\\MIA-KI~1\\LOCALS~1\\Temp\\php\\upload"

The single backslash tells most programs/scripts that the next
character is 'special'. When you echo upload_tmp_dir you will see
C:OCUME~1IA-KI~1OCALS~1emphppload

>| .
>| .
>| .
>| *********
>| The directory set in the 2nd instance:
>|
>| upload_tmp_dir="C:\DOCUME~1\MIA-KI~1\LOCALS~1\Temp\php\upload"
>|
>| exists on my pc, however, phpinfo() says 'upload_tmp_dir' is not set.
>|
>| If I uncomment the 1st instance and set it:
>|
>| upload_tmp_dir ="C:\tempphp" (a directory which I have created)
>|
>| phpinfo() reports 'upload_tmp_dir' is not set.
>|
>| I have tried puting the php.ini file in my wwwroot directory and in
>| the working directory containing the scripts (I think this is where it
>| should be) and still phpinfo() reports 'upload_tmp_dir' is not set.
>|
>| I have also tried ini_set('upload_tmp_dir', 'C:\tempphp');
>| that also does not work.
>|
>| *********************************************
>| Q1: How do I set the temporary upload file 'upload_tmp_dir' in windows XP.
>|
>| Q2: Once I have set 'upload_tmp_dir' how do I know the temproary file
>| name 'tmp_name' that php uses to hold that file before it gets moved using:
>|
>| move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)
>|
>| Thank You
>| Mike
>|
>|
>|
>| ********************************************
>| I use the following to generate a form to get the file name:
>| *****
>|
>| <!-- The data encoding type, enctype, MUST be specified as below -->
>| <form enctype="multipart/form-data"
>| action="http://localhost/php/upload.php" method="POST">
>| <!-- MAX_FILE_SIZE must precede the file input field -->
>| <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
>| <!-- Name of input element determines name in $_FILES array -->
>| Send this file: <input name="userfile" type="file" />
>| <input type="submit" value="Send File" />
>| </form>
>| <h1> hello world</h1>
>| </body>
>| </html>
>|
>| ******************************************
>| Then I use the following php script (http://localhost/php/upload.php) to
>| do the moving:
>| ******
>|
>| <html>
>| <body>
>| <?php
>| // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used
>| instead
>| // of $_FILES.
>|
>| $uploaddir = './upload/';
>| $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
>|
>| echo '<pre>';
>| if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
>| echo "File is valid, and was successfully uploaded.\n";
>| } else {
>| echo "Possible file upload problem\n";
>| }
>|
>| echo 'Here is some more debugging info:';
>| print_r($_FILES);
>|
>| print "</pre>";
>|
>| ?>
>| </body>
>| </html>
>| ***********************************
>|
>| I get the following output:
>|
>| *******
>|
>| Possible file upload problem
>| Here is some more debugging info:Array
>| (
>| [userfile] => Array
>| (
>| [name] => usage_rights.txt
>| [type] =>
>| [tmp_name] =>
>| [error] => 6
>| [size] => 0
>| )
>|
>| )

-- -------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
-- -------------------------------------------------------------
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:04 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0