470,811 Members | 1,181 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,811 developers. It's quick & easy.

file 'upload'


I am trying to use a form that is usually used for file uploads to obtain a
path/filename.
The form I'm using is:

<form id="f1" action="e.php" method="get">
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
select file: <input name="cwdrf" size="55" type="file" value=""><br>
<input type=submit value=submit >
</form>

I'd like to get the path/ filename to the file, e.php:
<?
echo $_REQUEST['cwdrf'];
?>

Although the text window in the form shows the full path, only the file name
gets through to e.php.
Is there some predefined variable that will get the full path?
Dec 20 '05 #1
2 1547
"james troy" <je*****@comcast.net> wrote in message
news:D5******************************@comcast.com. ..

I am trying to use a form that is usually used for file uploads to obtain
a path/filename.
The form I'm using is:

<form id="f1" action="e.php" method="get">
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
select file: <input name="cwdrf" size="55" type="file" value=""><br>
<input type=submit value=submit >
</form>

I'd like to get the path/ filename to the file, e.php:
<?
echo $_REQUEST['cwdrf'];
?>

Although the text window in the form shows the full path, only the file
name gets through to e.php.
Is there some predefined variable that will get the full path?

It should not concern the server script, what the original path and file
location of the uploaded file was, thus no such information is sent to the
server. Just the name of the original file. I'm wondering what were you
going to do with the path information. Whatever the reason, you can't do
that using the file field, it simply doesn't send such information.

Use print_r($_FILES); to see what information of the file is provided in
php.

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviö
an*******************@gmail.com.NOSPAM.invalid
Dec 20 '05 #2
Kimmo Laine wrote:
"james troy" <je*****@comcast.net> wrote in message
news:D5******************************@comcast.com. ..
I am trying to use a form that is usually used for file uploads to obtain
a path/filename.
The form I'm using is:

<form id="f1" action="e.php" method="get">
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
select file: <input name="cwdrf" size="55" type="file" value=""><br>
<input type=submit value=submit >
</form>

I'd like to get the path/ filename to the file, e.php:
<?
echo $_REQUEST['cwdrf'];
?>

Although the text window in the form shows the full path, only the file
name gets through to e.php.
Is there some predefined variable that will get the full path?


It should not concern the server script, what the original path and file
location of the uploaded file was, thus no such information is sent to the
server. Just the name of the original file. I'm wondering what were you
going to do with the path information. Whatever the reason, you can't do
that using the file field, it simply doesn't send such information.

Use print_r($_FILES); to see what information of the file is provided in
php.


The case where I wanted something like this, the script was generating a
report, and wanted a filename from the user, but wasn't interested in
the file. Of course I could have used a text field, but by using a file
field I got the browser to offer the user a file-browse dialogue. I
didn't manage to solve James's problem though.

Colin
Dec 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Tihon | last post: by
15 posts views Thread by Simon | last post: by
2 posts views Thread by matt | last post: by
7 posts views Thread by pbd22 | last post: by
Jacotheron
6 posts views Thread by Jacotheron | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.