phpbar.de logo

Mailinglisten-Archive

[php] dateiupload

[php] dateiupload

Cyrill Schumacher php_(at)_phpcenter.de
Thu, 17 May 2001 18:47:54 +0200


> ich habe probleme mit dateiinformationen nach einem upload.
> wie komme ich an die dateigröße und wie an den originalnamen der datei(so
> wie er lokal ist und nicht der temp-name)?

RTFM - features.file-upload.html

In PHP 3, the following variables will be defined within the destination
script upon a successful upload, assuming that register_globals is turned on
in php3.ini. If track_vars is turned on, they will also be available in PHP
3 within the global array $HTTP_POST_VARS. Note that the following variable
names assume the use of the file upload name 'userfile', as used in the
example above:


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

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

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

$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 INPUT field of TYPE=file is in the upload form. In the above upload
form example, we chose to call it "userfile"

In PHP 4, the behaviour is slightly different, in that the new global array
$HTTP_POST_FILES is provided to contain the uploaded file information. This
is still only available if track_vars is turned on, but track_vars is always
turned on in versions of PHP after PHP 4.0.2.

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 above:


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

blablabla





php::bar PHP Wiki   -   Listenarchive