Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Paste into input type file

Status
Not open for further replies.

louie728

Programmer
Feb 4, 2004
27
US
Hello all. I have a situation with a input file type. I cannot set the .value due to security reasons and I cannot set focus to the control then do a document.execCommand("paste"); (to paste from the clipboard) because of the same reason, these two methods work fine with regular input text types. I would like to know if there is a way that I could either emulate a ctrl+V keypress as a function or maybee control the actual browser menu so that I may paste the clipboard contents...

Thank you
 
Thank you for your reply Dan, but I already went this route and the value property cannot be set on an input type=file that is why I would like to paste.

 
You can't set the value of a file input. If you could, any web page could copy files from your computer without you knowing it. There used to be a hack in IE where you could set it if you switched the page to design-mode and using the "paste" method, but that has since been patched.

Adam
while(ignorance){perpetuate(violence,fear,hatred);life=life-1};
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top