Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 17th, 2005, 11:54 AM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
Default file form element

hi everybody,

  I have this trivial problem.I can't clear the text in the file upload form field element after writing into it and the

document.getElementById("theFile").value="";

wouldn't work at all for the following tag:

<input type="file" id="theFile" name="theFile" >

what shall I do?:(

 
Old January 17th, 2005, 12:29 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Another security feature.
You have to remove the element completely and re-insert it using the DOM.
Alternatively reset the form but then you will lose all other entere data.



--

Joe (Microsoft MVP - XML)
 
Old January 17th, 2005, 12:39 PM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was to do the same job(remove and insert it again)
I have never thought about what security problem would arise if this element could be set via
javascript.But it would be nice if it had some reset method, Since I don't see any security
issue in resetting the field.
thank you...

 
Old January 18th, 2005, 06:14 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well if you could set the value you could programatically submit the form and upload a file without the user knowing. I also fail to see how a reset method could be abused.

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML DOM - clone form element could not be aligned Shibu Javascript 5 November 15th, 2008 11:24 PM
positioning text + form element + firefox Adam H-W CSS Cascading Style Sheets 2 June 12th, 2007 03:18 AM
Dynamic Form Element Creation (ASP.NET) pollockc ASP.NET 2.0 Professional 1 March 13th, 2006 04:32 PM
Getting form element names in a loop crapanz Javascript 5 January 30th, 2006 12:45 AM
Form element "memory" - for checkboxes SoC VBScript 1 September 1st, 2004 04:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.