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

Copy File Field Value to Dynamic File Field Value

P: n/a
Firefox showed me a security error when I was copying a value of file
field object into new DOM created input file field. Can I do something
about it?
Thanks.

Nov 7 '07 #1
Share this Question
Share on Google+
19 Replies


P: n/a
VUNETdotUS wrote:
Firefox showed me a security error when I was copying a value of file
field object into new DOM created input file field. Can I do something
about it?
Nope, it's a security issue, you're not able to manipulate file fields.

--
# Regards || piotr[.]solnica[at]gmail[.]com || jid : s0****@jabster.pl #
# s0lnic || http://blog.solnic.in5.pl || icq : 385935391 #
Nov 7 '07 #2

P: n/a
On Nov 7, 9:55 am, s0lnic <l...@my.sigwrote:
VUNETdotUS wrote:
Firefox showed me a security error when I was copying a value of file
field object into new DOM created input file field. Can I do something
about it?

Nope, it's a security issue, you're not able to manipulate file fields.

--
# Regards || piotr[.]solnica[at]gmail[.]com || jid : s0l...@jabster.pl #
# s0lnic ||http://blog.solnic.in5.pl || icq : 385935391 #
can I copy input as a DOM object to another form (thus keeping its
value)?

Nov 7 '07 #3

P: n/a
VUNETdotUS said the following on 11/7/2007 9:33 AM:
Firefox showed me a security error when I was copying a value of file
field object into new DOM created input file field. Can I do something
about it?
Yes. Stop trying to copy the value of a file input.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 7 '07 #4

P: n/a
On Nov 7, 12:51 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
VUNETdotUS said the following on 11/7/2007 9:33 AM:
Firefox showed me a security error when I was copying a value of file
field object into new DOM created input file field. Can I do something
about it?

Yes. Stop trying to copy the value of a file input.
Sounds inspiring.
>
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/

Nov 7 '07 #5

P: n/a
VUNETdotUS said the following on 11/7/2007 1:41 PM:
On Nov 7, 12:51 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
>VUNETdotUS said the following on 11/7/2007 9:33 AM:
>>Firefox showed me a security error when I was copying a value of file
field object into new DOM created input file field. Can I do something
about it?
Yes. Stop trying to copy the value of a file input.

Sounds inspiring.
Whether inspiring or not, it is true.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 7 '07 #6

P: n/a
On Nov 7, 3:40 pm, VUNETdotUS <vunet...@gmail.comwrote:
On Nov 7, 3:28 pm, Darko <darko.maksimo...@gmail.comwrote:
s0lnic. cloneNode seems to be not browser compatible, doesn't it? I'll
try to test now...
Thanks.
Obviously, IE doe snot support. Is anyone familiar with cross browser
idea for cloning?
Nov 7 '07 #7

P: n/a
VUNETdotUS wrote:
Obviously, IE doe snot support. Is anyone familiar with cross browser
idea for cloning?
Oh well ;) Why do you want to clone them anyway? What do you want to
achieve?

--
# Regards || piotr[.]solnica[at]gmail[.]com || jid : s0****@jabster.pl #
# s0lnic || http://blog.solnic.in5.pl || icq : 385935391 #
Nov 7 '07 #8

P: n/a
On Nov 7, 5:05 pm, s0lnic <l...@my.sigwrote:
VUNETdotUS wrote:
Obviously, IE doe snot support. Is anyone familiar with cross browser
idea for cloning?

Oh well ;) Why do you want to clone them anyway? What do you want to
achieve?

--
# Regards || piotr[.]solnica[at]gmail[.]com || jid : s0l...@jabster.pl #
# s0lnic ||http://blog.solnic.in5.pl || icq : 385935391 #
I need it to upload the files without refreshing the page. So, my new
hidden,
dynamically created DOM
form is submitting file value to iframe and user keeps on working with
current
visible form.

Nov 7 '07 #9

P: n/a
VUNETdotUS wrote:
I need it to upload the files without refreshing the page. So, my new
hidden,
dynamically created DOM
form is submitting file value to iframe and user keeps on working with
current
visible form.
Oh, so submit the form and dynamically create a new one...user won't see
anything, don't worry. This method works on every major browser.

--
# Regards || piotr[.]solnica[at]gmail[.]com || jid : s0****@jabster.pl #
# s0lnic || http://blog.solnic.in5.pl || icq : 385935391 #
Nov 7 '07 #10

P: n/a
On Nov 7, 5:44 pm, s0lnic <l...@my.sigwrote:
VUNETdotUS wrote:
I need it to upload the files without refreshing the page. So, my new
hidden,
dynamically created DOM
form is submitting file value to iframe and user keeps on working with
current
visible form.

Oh, so submit the form and dynamically create a new one...user won't see
anything, don't worry. This method works on every major browser.

--
# Regards || piotr[.]solnica[at]gmail[.]com || jid : s0l...@jabster.pl #
# s0lnic ||http://blog.solnic.in5.pl || icq : 385935391 #
do you mean I have to submit the original for and then repaint it
plugging all values in? I do not know really...

Nov 7 '07 #11

P: n/a
On Nov 7, 10:47 pm, VUNETdotUS <vunet...@gmail.comwrote:
On Nov 7, 3:40 pm, VUNETdotUS <vunet...@gmail.comwrote:
On Nov 7, 3:28 pm, Darko <darko.maksimo...@gmail.comwrote:
s0lnic. cloneNode seems to be not browser compatible, doesn't it? I'll
try to test now...
Thanks.

Obviously, IE doe snot support. Is anyone familiar with cross browser
idea for cloning?
Try it harder. Maybe s0lnic made a syntax error, or forgot to put an
argument, but cloneNode
indeed *does* work in IE, which I have proofs for:
* I use it a lot and have tested it on IE, 6 and 7
* I used it with exactly the same purpose as yours, for sending a
file to server, in a hidden form inside
an iframe, by cloning the visible input type=file into the form and
then calling submit() on form.
Search the Internet for references of cloneNode usage, and try to
debug the script reading through
error messages. As for cloneNode, once it works in Mozilla, it will
work in IE. I guarantee.

Cheers.

Nov 8 '07 #12

P: n/a
Darko said the following on 11/7/2007 3:28 PM:
On Nov 7, 9:00 pm, VUNETdotUS <vunet...@gmail.comwrote:
<snip>
>that could be one of the solutions, but if I keep one form, can I
clone the file object, perhaps? Or, is it the only solution to break
the form?
Thanks

Randy Webb used to write some good posts in the past, but with all due
respect breaking the page into iframes sound horrible. As for the
question, if the topic starter only read what he head been told, he
would have noticed that s0lnic gave him the solution above, with code
and everything. And it works.
Did you test it in the most predominant browser on the web? Internet
Explorer creates a second file input but doesn't set the value property
of that file input. Not real "safe" on the WWW, do you think?
It is no security issue whatsoever, since you only clone what the
client had already filled in, so I don't see a reason for panic.
Reason 1: It relies on a flaw in Opera and Mozilla.
Reason 2: It doesn't "work" in the most predominant browser on the web.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 8 '07 #13

P: n/a
Darko said the following on 11/7/2007 6:56 PM:
On Nov 7, 10:47 pm, VUNETdotUS <vunet...@gmail.comwrote:
>On Nov 7, 3:40 pm, VUNETdotUS <vunet...@gmail.comwrote:
>>On Nov 7, 3:28 pm, Darko <darko.maksimo...@gmail.comwrote:
s0lnic. cloneNode seems to be not browser compatible, doesn't it? I'll
try to test now...
Thanks.
Obviously, IE doe snot support. Is anyone familiar with cross browser
idea for cloning?

Try it harder.
You can try it all you want to and IE still isn't going to set the
..value property of the file input.
Maybe s0lnic made a syntax error, or forgot to put an argument,
but cloneNode indeed *does* work in IE, which I have proofs for:
Nobody said cloneNodes doesn't work in IE. It will *not* set the value
of the input though.
* I use it a lot and have tested it on IE, 6 and 7
Did you test it with a file input that has a value chosen by the user?
Make a test file with an input type="file", use the browser button and
choose a file.
Use cloneNode to clone the input.

Tell us all what the value of that input is. It will be empty.
* I used it with exactly the same purpose as yours, for sending a
file to server, in a hidden form inside an iframe, by cloning the
visible input type=file into the form and then calling submit() on form.
Code that does it in IE?
Search the Internet for references of cloneNode usage, and try to
debug the script reading through error messages. As for cloneNode,
once it works in Mozilla, it will work in IE. I guarantee.
That I want to see.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 8 '07 #14

P: n/a
On Nov 8, 1:50 am, Randy Webb <HikksNotAtH...@aol.comwrote:
Darko said the following on 11/7/2007 6:56 PM:
On Nov 7, 10:47 pm, VUNETdotUS <vunet...@gmail.comwrote:
On Nov 7, 3:40 pm, VUNETdotUS <vunet...@gmail.comwrote:
>On Nov 7, 3:28 pm, Darko <darko.maksimo...@gmail.comwrote:
s0lnic. cloneNode seems to be not browser compatible, doesn't it? I'll
try to test now...
Thanks.
Obviously, IE doe snot support. Is anyone familiar with cross browser
idea for cloning?
Try it harder.

You can try it all you want to and IE still isn't going to set the
.value property of the file input.
Maybe s0lnic made a syntax error, or forgot to put an argument,
but cloneNode indeed *does* work in IE, which I have proofs for:

Nobody said cloneNodes doesn't work in IE. It will *not* set the value
of the input though.
* I use it a lot and have tested it on IE, 6 and 7

Did you test it with a file input that has a value chosen by the user?
Make a test file with an input type="file", use the browser button and
choose a file.
Use cloneNode to clone the input.

Tell us all what the value of that input is. It will be empty.
* I used it with exactly the same purpose as yours, for sending a
file to server, in a hidden form inside an iframe, by cloning the
visible input type=file into the form and then calling submit() on form.

Code that does it in IE?
Search the Internet for references of cloneNode usage, and try to
debug the script reading through error messages. As for cloneNode,
once it works in Mozilla, it will work in IE. I guarantee.

That I want to see.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
You were right. I must have confused it with something else I've
tested with IE :)
All disregards accepted in advance. Sorry.

Still, I think it is not any security issue, and I stand behind that.
If the user
chose a file in the input field, why would he care if I just let
another field do it.
If the answer is "we might trick him", than we might trick him with a
single field as well.
To conclude, if a user agrees to send a file to the server, then it
doesn't matter if I send
it using another form, the way I see it. From that aspect, it's only a
bug in IE, not Mozilla.
The way I see it.

Darko

Nov 8 '07 #15

P: n/a
SAM
Darko a écrit :
As for cloneNode, once it works in Mozilla, it will
work in IE. I guarantee.
Hu ?

http://stephane.moriaux.pagesperso-o...nerHTML_danger
with tests for innerHTML and cloneNode
to try with IE *and* compliant browsers

results are a little different ... !

--
sm
Nov 8 '07 #16

P: n/a
On Nov 8, 1:36 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
Darko a écrit :
As for cloneNode, once it works in Mozilla, it will
work in IE. I guarantee.

Hu ?

http://stephane.moriaux.pagesperso-o...nerHTML_danger
with tests for innerHTML and cloneNode
to try with IE *and* compliant browsers

results are a little different ... !

--
sm
Look at my last post. I admitted Randy Webb was right about not being
able to successfully
clone the file input. Your quoting my "I guarantee" section doesn't
make me feel good
about my self :)

But, cloning itself indeed does work with Internet Explorer, it just
doesn't copy the object's
value, too, as Webb already said, when input type=file is object of
cloning.
The cloning itself, however, works and the link you've provided should
work in IE.

Nov 8 '07 #17

P: n/a
SAM
Darko a écrit :
On Nov 8, 1:36 pm, SAM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
>>
http://stephane.moriaux.pagesperso-o...nerHTML_danger
with tests for innerHTML and cloneNode
to try with IE *and* compliant browsers

results are a little different ... !
Your quoting my "I guarantee" section doesn't
make me feel good about my self :)
Ha! bon! OK ;-)
But, cloning itself indeed does work with Internet Explorer, it just
doesn't copy the object's
value, too, as Webb already said, when input type=file is object of
cloning.
I didn't try with a filed file input.
(in Firefox for instance)
Usually when I clone a node, this node is a referent hidden one and if
it is a form's field it's empty. This way no problem with IE.
The cloning itself, however, works and the link you've provided should
work in IE.
Ho! Yes, IE can clone a node, but ...
.... with certain limits we have to know.

That just was the object of my post.

--
sm

Nov 8 '07 #18

P: n/a
VUNETdotUS wrote:
do you mean I have to submit the original for and then repaint it
plugging all values in? I do not know really...
In case you have other fields in that form, not only file inputs, then
submitting the original form doesn't make any sense of course. Your
solution with appending file inputs to a new form is far better then what
I've suggested.

--
# Regards || piotr[.]solnica[at]gmail[.]com || jid : s0****@jabster.pl #
# s0lnic || http://blog.solnic.in5.pl || icq : 385935391 #
Nov 8 '07 #19

P: n/a
Darko wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
>s0lnic wrote:
>>VUNETdotUS wrote:
I need it to upload the files without refreshing the page. So, my new
hidden, dynamically created DOM form is submitting file value to iframe
and user keeps on working with current visible form.
Oh, so submit the form and dynamically create a new one...user won't see
anything, don't worry. This method works on every major browser.
Unless, of course, for some reason either client-side script support or
sufficient DOM support is not available.

Bad idea.
[...]

Unless he's got lynx :)
This is by far not the only one possibility for that.

Please trim your quotes, see
http://www.jibbering.com/faq/faq_notes/clj_posts.html
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>
Nov 10 '07 #20

This discussion thread is closed

Replies have been disabled for this discussion.