HighDots Forums  

Full Pathname: Browsing - <input type=file>

alt.html.tags alt.html.tags


Discuss Full Pathname: Browsing - <input type=file> in the alt.html.tags forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jeff Peters
 
Posts: n/a

Default Full Pathname: Browsing - <input type=file> - 04-05-2005 , 01:41 PM







Hi;
I need to capture the full pathname of a file as input to a php
script and am using <form type=file> as a user interface to avoid having
to type the full pathname manually. When I use the browse button on the
form and select a file from the dialog, the result is the filename but
not the path information. The full path comes up in the text input box
but the path portion discarded on submission. if I type the full
pathname into the textbox and submit the full pathname I type is
submitted as expected, but not if I browse. Is there a way to browse and
capture the full pathname.

Thanks for any assistance

Jeff


Reply With Quote
  #2  
Old   
Lachlan Hunt
 
Posts: n/a

Default Re: Full Pathname: Browsing - <input type=file> - 04-06-2005 , 11:10 PM






Jeff Peters wrote:
Quote:
I need to capture the full pathname of a file as input to a php
script and am using <form type=file> as a user interface to avoid having
to type the full pathname manually....
Is there a way to browse and capture the full pathname.
No, you can't. Why do you want to know where a user stores their files
on their own computer anyway? Not only would that would be a security
risk if you could, but the behaviour you described about the browser
showing the full path is implementation specific.

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox


Reply With Quote
  #3  
Old   
Jim Michaels
 
Posts: n/a

Default Re: Full Pathname: Browsing - <input type=file> - 02-04-2006 , 04:32 AM




"Lachlan Hunt" <spam.my.gspot (AT) gmail (DOT) com> wrote

Quote:
Jeff Peters wrote:
I need to capture the full pathname of a file as input to a php
script and am using <form type=file> as a user interface to avoid having
to type the full pathname manually....
Is there a way to browse and capture the full pathname.

<form type=file> doesn't exist. <form enctype="multipart/form-data"> does,
which is exactly what is required for forms with file uploads.

try doing a print_r() on $_FILES['myfieldname'] and see what you get. but I
think he's right.
you get the source path and the temp file path if I remember right.
<?php
$uploaddir="uploads/";
$filename=trim($_FILES['upfile']['name'];
$filename=substr($filename, -20);
$filename=ereg_replace(" ","",$filename);
if ((ereg(".jpg",$filename))||(ereg(".gif",$filename) )) {
$uploadfile=$uploaddir . $filename;
if (move_uploaded_file($_FILES['upfile']['tmp_name'],$uploadfile)) {
chmod($uploadfile,0644);
print("File upload was successful");
} else {
print("File upload failed");
}
} else {
print("Only images are allowed, upload failed");
}
?>

Quote:
No, you can't. Why do you want to know where a user stores their files on
their own computer anyway? Not only would that would be a security risk
if you could, but the behaviour you described about the browser showing
the full path is implementation specific.

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.