Re: determine file-upload's tmp-filename
| From: | Michael Fischer | Date: | Sun, 27 Jan 2008 09:40:47 +0000 |
| Subject: | Re: determine file-upload's tmp-filename | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268166@lists.php.net to get a copy of this message | ||
-------- Original-Nachricht --------
> Datum: Sun, 27 Jan 2008 01:21:19 -0800
> Von: Brady Mitchell <mydarb@gmail.com>
> An: Michael Fischer <michi.fischer@gmx.net>
> CC: php-general@lists.php.net
> Betreff: Re: [PHP] determine file-upload\'s tmp-filename
> On Jan 26, 2008, at 357PM, Michael Fischer wrote:
>
> > hi there,
> >
> > is there a way to determine the tmp-filename of a file upload while
> > the upload is still in progress?
>
> I'm not sure when it becomes available, but $_FILES['file_name']
> ['tmp_name'] is the only place I know of to find the temporary name.
>
> > the tmp-file is stored in /tmp and it's name is something like
> > PHPXXXXXXXX.
> >
> > what i would like to do is:
> > i want to upload a file via a html-form and while the upload is in
> > progress make repeatedly ajax-requests to a php-script on the server
> > that replies the size of the tmp file (the amount of data that was
> > already uploaded). So in this script i need to know what the tmp-
> > filename is.
>
> You could try doing a print_r($_GLOBALS); in that script to find out
> if there are any other helpful places to check.
>
> HTH,
>
> Brady
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
hm, there's nothing to spectacular in $_GLOBALS:
Array
(
[GLOBALS] => Array
*RECURSION*
[_ENV] => Array
(
[TERM] => xterm
[SHELL] => /bin/bash
[DEFAULTLEVEL] => default
[LC_ALL] => de_DE@euro
[USER] => root
[PATH] =>
/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/usr/i386-pc-linux-gnu/gcc-bin/3.4.4
[PWD] => /etc/apache2/modules.d
[LANG] => de_DE@euro
[BOOTLEVEL] => boot
[SVCNAME] => apache2
[CONSOLETYPE] => pty
[SHLVL] => 1
[HOME] => /home/albert
[SOFTLEVEL] => default
[_] => /usr/sbin/apache2
)
[HTTP_ENV_VARS] => Array
(
[TERM] => xterm
[SHELL] => /bin/bash
[DEFAULTLEVEL] => default
[LC_ALL] => de_DE@euro
[USER] => root
[PATH] =>
/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/usr/i386-pc-linux-gnu/gcc-bin/3.4.4
[PWD] => /etc/apache2/modules.d
[LANG] => de_DE@euro
[BOOTLEVEL] => boot
[SVCNAME] => apache2
[CONSOLETYPE] => pty
[SHLVL] => 1
[HOME] => /home/albert
[SOFTLEVEL] => default
[_] => /usr/sbin/apache2
)
[_POST] => Array
(
)
[HTTP_POST_VARS] => Array
(
)
[_GET] => Array
(
)
[HTTP_GET_VARS] => Array
(
)
[_COOKIE] => Array
(
[PHPSESSID] => a959c533aa718bc94801431ae34f6fa6
)
[HTTP_COOKIE_VARS] => Array
(
[PHPSESSID] => a959c533aa718bc94801431ae34f6fa6
)
[_SERVER] => Array
(
[UNIQUE_ID] => 6jqHi38AAAEAAHn7e14AAAAJ
[HTTP_X_REQUESTED_WITH] => XMLHttpRequest
[HTTP_ACCEPT_LANGUAGE] => de-at,en-us;q=0.5
[HTTP_REFERER] => http://webfischer.at/~albert/upload.php
[HTTP_ACCEPT] => text/javascript, text/html, application/xml, text/xml, */*
[HTTP_UA_CPU] => x86
[HTTP_ACCEPT_ENCODING] => gzip, deflate
[HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1)
[HTTP_HOST] => webfischer.at
[HTTP_CONNECTION] => Keep-Alive
[HTTP_COOKIE] => PHPSESSID=a959c533aa718bc94801431ae34f6fa6
[PATH] =>
/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/usr/i386-pc-linux-gnu/gcc-bin/3.4.4
[SERVER_SIGNATURE] => Apache Server at webfischer.at Port 80
[SERVER_SOFTWARE] => Apache
[SERVER_NAME] => webfischer.at
[SERVER_ADDR] => 192.168.0.2
[SERVER_PORT] => 80
[REMOTE_ADDR] => 193.80.38.250
[DOCUMENT_ROOT] => /var/www/htdocs
[SERVER_ADMIN] => root@localhost
[SCRIPT_FILENAME] => /home/albert/public_html/upload2.php
[REMOTE_PORT] => 62795
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /~albert/upload2.php
[SCRIPT_NAME] => /~albert/upload2.php
[PHP_SELF] => /~albert/upload2.php
[REQUEST_TIME] => 1201426541
[argv] => Array
(
)
[argc] => 0
)
[HTTP_SERVER_VARS] => Array
(
[UNIQUE_ID] => 6jqHi38AAAEAAHn7e14AAAAJ
[HTTP_X_REQUESTED_WITH] => XMLHttpRequest
[HTTP_ACCEPT_LANGUAGE] => de-at,en-us;q=0.5
[HTTP_REFERER] => http://webfischer.at/~albert/upload.php
[HTTP_ACCEPT] => text/javascript, text/html, application/xml, text/xml, */*
[HTTP_UA_CPU] => x86
[HTTP_ACCEPT_ENCODING] => gzip, deflate
[HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1)
[HTTP_HOST] => webfischer.at
[HTTP_CONNECTION] => Keep-Alive
[HTTP_COOKIE] => PHPSESSID=a959c533aa718bc94801431ae34f6fa6
[PATH] =>
/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/usr/i386-pc-linux-gnu/gcc-bin/3.4.4
[SERVER_SIGNATURE] => Apache Server at webfischer.at Port 80
[SERVER_SOFTWARE] => Apache
[SERVER_NAME] => webfischer.at
[SERVER_ADDR] => 192.168.0.2
[SERVER_PORT] => 80
[REMOTE_ADDR] => 193.80.38.250
[DOCUMENT_ROOT] => /var/www/htdocs
[SERVER_ADMIN] => root@localhost
[SCRIPT_FILENAME] => /home/albert/public_html/upload2.php
[REMOTE_PORT] => 62795
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /~albert/upload2.php
[SCRIPT_NAME] => /~albert/upload2.php
[PHP_SELF] => /~albert/upload2.php
[REQUEST_TIME] => 1201426541
[argv] => Array
(
)
[argc] => 0
)
[_FILES] => Array
(
)
[HTTP_POST_FILES] => Array
(
)
[_REQUEST] => Array
(
[PHPSESSID] => a959c533aa718bc94801431ae34f6fa6
)
[HTTP_SESSION_VARS] => Array
(
)
[_SESSION] => Array
(
)
)
wicked...
does anybody know what happens if the form-action is a simple html-file? where will the tmp-file be
stored?
lg, michi