By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,490 Members | 1,489 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,490 IT Pros & Developers. It's quick & easy.

displaying file path in file input field

P: n/a
Ben
Hi all,

i have file input field in a form like this:
<input name="isbn" type="text" size="25" value="<?php echo
$_POST['isbn'] ?>" />
<input name="image" type="file" size="25" value="<?php echo
$_FILES['image']['name'] ?>" />

when i press "submit" button, the same page gets loaded... if my
$_POST['isbn'] is empty, i want to have the file path on "file input
field" to redisplay on that same field... it's possible in text input
field but i don't know of a way to do it in file input fields...

Any suggestions?

Thanx
Ben
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Ben wrote:
Hi all,

i have file input field in a form like this:
<input name="isbn" type="text" size="25" value="<?php echo
$_POST['isbn'] ?>" />
<input name="image" type="file" size="25" value="<?php echo
$_FILES['image']['name'] ?>" />

when i press "submit" button, the same page gets loaded... if my
$_POST['isbn'] is empty, i want to have the file path on "file input
field" to redisplay on that same field... it's possible in text input
field but i don't know of a way to do it in file input fields...

Any suggestions?

Thanx
Ben


File input fields are read-only. There is no way, through either HTML,
Javascript, PHP, etc.. to give them a default value. This is because if
it were possible, it would be a security risk as people could create a
form that automatically inserts the path to a file on your computer,
then automatically submits the form to the server which would mean they
can steal your files. The best you could do is have a 'Previous entry:
' field either above or below it that people could copy/paste into the
file input.
Jul 17 '05 #2

P: n/a
.oO(kicken)
File input fields are read-only. There is no way, through either HTML,
Javascript, PHP, etc.. to give them a default value.


It was possible and still is in some older browsers.

Micha
Jul 17 '05 #3

P: n/a
Michael Fesser wrote:
.oO(kicken)
File input fields are read-only. There is no way, through either HTML,
Javascript, PHP, etc.. to give them a default value.


It was possible and still is in some older browsers.


And some recent ones. Opera 7.10 (yes, I will upgrade
presently), for example.

--
Jock
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.