473,657 Members | 2,537 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

displaying file path in file input field

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
3 4841
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
.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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2784
by: Paul M | last post by:
Hi there, i hope someone can help me out here.. I have a input screen where i want the user to enter text in 2 different languages, english and macedonian. How is it possible to make the macedonian input boxes so when you type into them, it is entered into macedonian font? I dont want the users to be downloading anything also. thanks,
4
3960
by: atse | last post by:
Hi, In the file field <input type="file" name="file1">, can I modify the button "Browse..."? I want to hide the file field but show a button like "Open". When I click on this button, it catches a file, and use onchange even to upload this file. thanks for any idea. Atse
1
5546
by: Monte Chan | last post by:
Hi all, I have the following codes, <script language="JavaScript"> function check_stuff(field) { alert("blank out the field now"); field.value = ""; } </script>
15
4752
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update button will verify the information that has been entered and updates the data base if the data is correct. Update will throw an exception if the data is not validate based on some given rules. I also have a custom error handling page to show the...
2
1647
by: james troy | last post by:
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>
8
3295
by: Jon Weston | last post by:
I'm setting up an Access2003 database with pictures. I put a bound ole picture ctrl on a form that's source is the table that contains the pictures and follow ALL the directions for embedding a picture. The ctrl in the form only displays the filename of the picture. The underlying table, when opened in table view, shows the word "package" in the field. When I double-click on either it opens the picture, but I can't get it to display. ...
4
2052
by: rn5a | last post by:
I am storing the physical path of images, along with 3 more columns, in a MS-Access DB table. I want to provide users the option to change this physical image path (as well as the records in the other columns) for which I am using the *File* Form element. The column under which the physical paths are stored is the 4th column in the DB table. Users first come to a page that displays the distinct records existing in column1 in the above...
2
7645
by: hotflash | last post by:
Hi All, I found the best pure ASP code to upload a file to either server and/or MS Access Database. It works fine for me however, there is one thing that I don't like and have tried to fix but don't have any luck is to do a form validation. This script requires the files: db-file-to-disk.asp and _upload.asp. There is a DESCRIPTION field in the db-file-to-disk.asp file, what I want to do is the user has to field out this fied before...
7
6651
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a tabcontainer which has 1 panel already, however I want to try create the TabPanels dynamically. I followed the advice here: http://www.asp.net/learn/ajax-videos/video-156.aspx (3rd comment - Joe Stagner)
0
8385
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8303
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8821
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8602
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7316
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1941
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.