Re: [PHP] Upload file name not file
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. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Upload file name not file
Hello, Id like to use the popup file system box(input name=userfile type=file /) to choose a file name , but I only want to upload the filename , not the file. Can I do that? Thanks Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upload file name not file
Id like to use the popup file system box(input name=userfile type=file /) to choose a file name , but I only want to upload the filename , not the file. Can I do that? You're not supposed to have any access to the remote visitor's computer, and the path to the file being uploaded could contain sensitive information (ie. like username of windows user). There are ways to get the information, even to read information on disk without the use of a file upload form. But they are/will be considered like security threats and are/will be closed down. IMO, whatever way you find to get this information is meant 1) not to be portable accross different browsers and 2) to stop working eventually. (Of course unless you ask the user to explicitly type the path in a text input) What do you need this for? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upload file name not file
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. Simon turne...@gmail.com wrote in message news:5f14cf5e0905010629s2253cc3bk2a83dbf8b754c...@mail.gmail.com... Id like to use the popup file system box(input name=userfile type=file /) to choose a file name , but I only want to upload the filename , not the file. Can I do that? You're not supposed to have any access to the remote visitor's computer, and the path to the file being uploaded could contain sensitive information (ie. like username of windows user). There are ways to get the information, even to read information on disk without the use of a file upload form. But they are/will be considered like security threats and are/will be closed down. IMO, whatever way you find to get this information is meant 1) not to be portable accross different browsers and 2) to stop working eventually. (Of course unless you ask the user to explicitly type the path in a text input) What do you need this for? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upload file name not file
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! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php