On Fri, 2009-05-01 at 12:38 -0400, Simon wrote:
> On Fri, May 1, 2009 at 9:34 AM, MikeP <mpel...@princeton.edu> wrote:
> > I'm not trying to get the path, just the filename and size, I know how to
> > get these, but that would include the file using $_Files, but I dont want to
> > upload anything just use the filename and size.(without the path) to insert
> > into a DB.
> Those are attributes of the file for which you dont have access
> remotely, and the only way to access this information without an
> upload will be using the same hacks as those spywarez use. A
> technology like flash has read/write access to the remote user's disk
> (to a certain extent), you could use flash to get that information and
> make it send it to you, same thing could be done with ActiveX, etc...
> PHP, JS and HTTP protocol cannot acheive what you want. (PHP is
> server-side, HTTP is for communication only, JS is client-side but
> locked down very much).
> However, at a very low level, it might be possible to achieve this in
> PHP, you could do the upload as if you wanted the whole file. But the
> first packet received will contain the HTTP Header, and in the header,
> you should have all the info you need (filename and size of data).
> So, low-level speaking, as soon as you receive the first packet and
> have the info, you just need to close the connection (remote end might
> display an error msg saying the upload failed, etc). PHP supports
> sockets connections, so you could make a basic 'server' that listens
> on another port to perform this. But i see no way to acheive your
> goal without complications.
> Good luck!
If you don't set the enctype to multipart/form-data in your form, then
only the filename will be uploaded as part of the form. To get the file
size you would have to allow the file to be uploaded, even if only to
the temporary directory.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php