RE: determine file-upload's tmp-filename

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The name of the upload tmp file MUST be known.  If the $_FILES[] is not
available until the upload completes; perhaps a kludge is to set a unique
upload_tmp_dir, for the session, that will only contain the upload for this
user in this session.  There will only be one file to monitor with
filesize().

* Now the server can know the destination filename.
The form will have to have an OnClick method that passes the srcfilesize to
the php service who stores it in a session variable.

The existence of the session variable enables the connection to the service
and the discovery of the location of the special upload directory

The service will just service requests for the filesize.

That's half the problem solved.  The other half is to make the srcfilesize
available to the client JavaScript.

-----Original Message-----
From: Michael Fischer [mailto:michi.fischer@xxxxxxx] 
Sent: Monday, January 28, 2008 3:51 PM
To: 'php-general'
Subject: RE:  determine file-upload's tmp-filename


On Mon, 2008-01-28 at 15:34 -0500, Mr Webber wrote:
> On Mon, 2008-01-28 at 12:17 -0600, Richard Lynch wrote:
> > On Sat, January 26, 2008 5:57 pm, 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?
> > >
> > > 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.
> > >
> > > or do you think this is a completely useless approach?
> > 
> > Google for PHP upload meter instead.
> > 
> > That's probably how it works, more or less...
> > 
> > I still think it's STOOPID to round-trip back and forth to the server
> > to get an upload progress meter -- The browser developers should be
> > providing you with some kind of progress notification system locally!
> > 
> well, i agree with you - the browser should provide some sort of
> functionality to find out the amount of data already sent. but i don't
> know any browser that does.
> 
> all the php upload meters that i found on google either require to
> patch php or use perl.
> 
> I have not done this, but am inspired to do it now.  My design is to
develop
> my own meter by compare $FILES;'size'] to the actual size on disk as the
> file uploads; I would use some sort of JavaScript / Ajax service
connection
> so that the upload meter is displayed in the current browsing window or an
> upload popup.
> 
> $_FILES['userfile']['name']
> $_FILES['userfile']['type']
> $_FILES['userfile']['size']
> $_FILES['userfile']['tmp_name']
> $_FILES['userfile']['error']
two problems:

- the $_FILES array becomes available when the file-upload is complete.
that's too late.

- how do you determine the actual size on the disk of the uploaded file,
while the upload is in progress?

lg, Michi
-- 
Sautergasse 27-29/35
1160 Wien
phone: 0043 650 2526276
email: michi.fischer@xxxxxxx
web: http://www.webfischer.at

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux