473,387 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Copy File Field Value to Dynamic File Field Value

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

Similar topics

3
by: Tim Pollard | last post by:
Hi I'm not much of a javascripter, so I don't know whether this is possible, but...... I have a pop-up window in my asp web app which lets the user select a record from table1 from an...
2
by: Marc Elser | last post by:
Hi, I have a html form which is created by a cgi-script which sometimes opens a popup window. This popup window reads it's content from a hidden field in the openers form and writes it through...
1
by: Simon Gare | last post by:
Hi I need to compare a dynamic field in an asp page to a field in another table, if there is no match then i would like to chane the row colour ( see code below). The problem Im having is...
2
by: Robert Fitzpatrick | last post by:
Does COPY require values for each column even though the database field is not set to NOT NULL? I did a COPY TO first to line up the data and then COPY FROM a tab delimited file. Here are the first...
2
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...
2
by: hotflash | last post by:
Hi Master CroCrew, I found a good PURE ASP that will allow you to upload 10MB file to the server and the file contents such as Network, Author, Title, etc... will insert to MS Access at the same...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
4
by: Michael Munch | last post by:
Hi I want to read the value of af text-field, create dynamic, in a form. Se below a small test-site to do that (but readning fails): I use the function Test_Read for reading the value from the...
1
DebadattaMishra
by: DebadattaMishra | last post by:
Introduction In case of rich applications, you must have observed that a text field behaves like a dynamic combo box. When the user enters some characters in the text field, a popup will come up...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
jinu1996
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 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.