Re: [PHP] File uploading fails

2002-05-01 Thread 1LT John W. Holmes

$HTTP_POST_FILES/$_FILES is provided to contain the uploaded file
information.

The contents of $HTTP_POST_FILES are as follows. Note that this assumes the
use of the file upload name 'userfile', as used in the example script above:


  $HTTP_POST_FILES['userfile']['name']
  The original name of the file on the client machine.

  $HTTP_POST_FILES['userfile']['type']
  The mime type of the file, if the browser provided this information. An
example would be "image/gif".

  $HTTP_POST_FILES['userfile']['size']
  The size, in bytes, of the uploaded file.

  $HTTP_POST_FILES['userfile']['tmp_name']
  The temporary filename of the file in which the uploaded file was stored
on the server.


  Note: PHP 4.1.0 or later supports a short track variable $_FILES. PHP 3
does not support $HTTP_POST_FILES.

When register_globals is turned on in php.ini the available variables are as
follows. Note that the following variable names assume the use of the file
upload name 'userfile', as used in the example script above:


  a.. $userfile - The temporary filename in which the uploaded file was
stored on the server machine.

  b.. $userfile_name - The original name or path of the file on the sender's
system.

  c.. $userfile_size - The size of the uploaded file in bytes.

  d.. $userfile_type - The mime type of the file if the browser provided
this information. An example would be "image/gif".

Note that the "$userfile" part of the above variables is whatever the name
of the  field of type="file" is in the upload form. In the above
upload form example, we chose to call it "userfile".

  Note: register_globals = On is not recommended for security and
performance reason.

Love that manual,

---John Holmes...

- Original Message -
From: "Tim Decker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 01, 2002 11:13 AM
Subject: [PHP] File uploading fails


> I have searched high and low and done everything
> recommended generically and yet am still having
> problems uploading files. My script is as follows:
> 
>  error_reporting(E_ALL);
> echo phpinfo();
> echo $file_name;
> echo $HTTP_POST_FILES['file']['name'];
> if (isset($file)){
> echo "Successfully uploaded ", $file_name, "\n";
> }
> ?>
>  enctype="multipart/form-data">
> 
> 
> 
> 
>
> Output is as follows:
>
> Warning: Undefined variable: file_name in addimage.php
> on line 5
>
> Warning: Undefined index: file in addimage.php on line
> 6
>
> I get this message with all the variations of file
> upload testing.
>
> FYI I'm trying to upload a 160K jpg file for testing.
>
> Using Apache and Linux server. WIN IE Client.
>
> Help would be greatly appreciated.
>
> TIA,
> Tim
> unka_timmyATyahoo.com
>
>
> __
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness
> http://health.yahoo.com
>
> --
> 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




Re: [PHP] File uploading fails

2002-05-01 Thread Pushkar Pradhan

You haven't defined $file_name before trying to echo it, I think you'll
have to create it using $HTTP_POST_...['file'] and HTT...['name']
Also check your php.ini to see if file uploads are allowed and if yes the
max. limit.
> I have searched high and low and done everything
> recommended generically and yet am still having
> problems uploading files. My script is as follows:
> 
>  error_reporting(E_ALL);
> echo phpinfo();
> echo $file_name;
> echo $HTTP_POST_FILES['file']['name'];
> if (isset($file)){
> echo "Successfully uploaded ", $file_name, "\n";
> }
> ?>
>  enctype="multipart/form-data">
> 
> 
> 
> 
>
> Output is as follows:
>
> Warning: Undefined variable: file_name in addimage.php
> on line 5
>
> Warning: Undefined index: file in addimage.php on line
> 6
>
> I get this message with all the variations of file
> upload testing.
>
> FYI I'm trying to upload a 160K jpg file for testing.
>
> Using Apache and Linux server. WIN IE Client.
>
> Help would be greatly appreciated.
>
> TIA,
> Tim
> unka_timmyATyahoo.com
>
>
> __
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness
> http://health.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php