Hi All,
I need the file chooser in the jsp, just for brosing and saving the
file path in the database, so i have used the following code.I dont
need to read the file content. I have to make it hidden because in
edit mode i need to show the field prepopulated with the file path,
which doesnot happen with input type=file, it cant be shown
prepopulated. But the following code gives access denied error.Please
help.
<html>
<head>
<script>
function browseFile(){
document.form.browse .click();
document.form.filename.value=document.form.browse. value;
return true;
}
</script>
</head>
<body>
<form name="test_form" method="post" action="test.jsp">
<input type=file name=browse style="display: none;">
<input type=text name=filename>
<input type=button value="Select a File..." onClick="browseFile();">
<input type=submit value="Submit The Form Now!">
</form>
</body>
</html>
Thanks for help. 5 8011
hrpreet написав:
Hi All,
I need the file chooser in the jsp, just for brosing and saving the
file path in the database, so i have used the following code.I dont
need to read the file content. I have to make it hidden because in
edit mode i need to show the field prepopulated with the file path,
which doesnot happen with input type=file, it cant be shown
prepopulated. But the following code gives access denied error.Please
help.
<html>
<head>
<script>
function browseFile(){
document.form.browse .click();
document.form.filename.value=document.form.browse. value;
return true;
}
</script>
</head>
<body>
<form name="test_form" method="post" action="test.jsp">
<input type=file name=browse style="display: none;">
<input type=text name=filename>
<input type=button value="Select a File..." onClick="browseFile();">
<input type=submit value="Submit The Form Now!">
</form>
</body>
</html>
Thanks for help.
document.test_form.browse.click();
document.test_form.filename.value=document.test_fo rm.browse.value;
hrpreet said the following on 10/16/2006 11:27 PM:
Hi All,
I need the file chooser in the jsp, just for brosing and saving the
file path in the database, so i have used the following code.I dont
need to read the file content. I have to make it hidden because in
edit mode i need to show the field prepopulated with the file path,
which doesnot happen with input type=file, it cant be shown
prepopulated. But the following code gives access denied error.Please
help.
You get that error message because you can't programatically set the
value of a file input element. It's a security violation.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
Randy Webb <Hi************@aol.comwrote:
>You get that error message because you can't programatically set the value of a file input element. It's a security violation.
He's not trying to. He's retrieving the value of the <input
type="file"...and assigning that to an <input type="text"...>
element.
Why he needs to do that, I don't understand. The "file" element
includes a text box that gets set to the name of the file selected. It
seems that would show the exact same thing that he's trying to show in
his "text" box.
--
Tim Slattery Sl********@bls.gov
Hi All,
This is required since in case of updation need , i need to show the
file text box prepopulated, but this doesnot happen, not allowed.
Thanks
Tim Slattery wrote:
Randy Webb <Hi************@aol.comwrote:
You get that error message because you can't programatically set the
value of a file input element. It's a security violation.
He's not trying to. He's retrieving the value of the <input
type="file"...and assigning that to an <input type="text"...>
element.
Why he needs to do that, I don't understand. The "file" element
includes a text box that gets set to the name of the file selected. It
seems that would show the exact same thing that he's trying to show in
his "text" box.
--
Tim Slattery Sl********@bls.gov
hrpreet wrote on 19 okt 2006 in comp.lang.javascript :
Tim Slattery wrote:
>Randy Webb <Hi************@aol.comwrote:
>You get that error message because you can't programatically set the value of a file input element. It's a security violation.
He's not trying to. He's retrieving the value of the <input type="file"...and assigning that to an <input type="text"...> element.
Why he needs to do that, I don't understand. The "file" element includes a text box that gets set to the name of the file selected. It seems that would show the exact same thing that he's trying to show in his "text" box.
[Please do not toppost on usenet]
This is required since in case of updation need , i need to show the
file text box prepopulated, but this doesnot happen, not allowed.
If you change "need" to "want" you are right.
However, security is about not always getting what you want.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ron Brennan |
last post by:
Good afternoon.
The entire task that I'm trying to achieve is to allow a user to browse and
upload multiple files simultaneously, hiding the Browse button of <input>
tags of type="file" and...
|
by: Ersin Gentrk |
last post by:
hi ,
I need to customize <input type=file , tag.
I find a way to do that : on the client side by javascript and css first , I
am hiding the fileupload object , then I am calling the click...
|
by: Ersin Gentrk |
last post by:
hi ,
I need to customize <input type=file , tag.
I find a way to do that : on the client side by javascript and css first , I
am hiding the fileupload object , then I am calling the click...
|
by: HNguyen |
last post by:
Access denied error while uploading a file to a web server.
I am getting the following error while trying to upload a file to our web
server: Error: Access to the path...
|
by: TJM |
last post by:
Hi,
A Javascript error is generated when the user types a few character in an
INPUT TYPE=FILE and hits a submit button. The form does not post. Is there a
solution to this problem?
Thanks
TJM
| |
by: SammyBar |
last post by:
Hi all,
I wonder is it possible to upload the content of an <imgfield to a server.
The content of the <imgwas downloaded from a web site different from the
one it should be uploaded. The image...
|
by: suresh_nsnguys |
last post by:
Hi,
This is my first message to this forum.I am facing one problem in frames.when i am trying to access child frame from parent frame i am getting "Access Denied Error".i know the reason bcz i...
|
by: omerbutt |
last post by:
hi there i have a form with multiple input (type/text ) fields and three inputs(type/file) fields i have to submit the form via ajax because i have multiple forms on this page ,you can say it is a...
|
by: passionateforjava |
last post by:
Hi All,
I am using struts application wherein I need to import file for some purpose.I have used input type="file" for the same which goes like:
<input type="file" id="uploadFile" name="uploadFile"...
|
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,...
|
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...
| |
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
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 projectplanning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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 ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| | |