473,385 Members | 1,907 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,385 software developers and data experts.

Creating files on client side using javascript

Hi ,

This is my first attempt to do some html/javascript programming and I
am totally lost. I have a questionaire form and when user clicks
Submit, I want to save the data in XML file on client side. User will
then sync all these xml files to a PC later. From all the research I
have done so far, its being indicated that client side file creation
is not possible - is that true? If yes, then I have a huge problem -
is there anyway I can create these files? Any suggestion would be
really appreciated. PLease remeber that I am novice to all this.

Thanks
LostShoul!
Jun 27 '08 #1
9 8069
On Jun 20, 9:37 am, shailaja.sh...@gmail.com wrote:
Hi ,

This is my first attempt to do some html/javascript programming and I
am totally lost. I have a questionaire form and when user clicks
Submit, I want to save the data in XML file on client side. User will
then sync all these xml files to a PC later. From all the research I
have done so far, its being indicated that client side file creation
is not possible - is that true?
Yes, you CAN NOT access client side file system with standard
javascript...
If yes, then I have a huge problem -
is there anyway I can create these files? Any suggestion would be
really appreciated. PLease remeber that I am novice to all this.
Once the form is posted you can create xml file on the server and send
it back to the client for download - i.e. your response to form post
maybe a generated xml file, or a page with a link to download one...
>
Thanks
LostShoul!
Jun 27 '08 #2
sh************@gmail.com meinte:
Hi ,

This is my first attempt to do some html/javascript programming and I
am totally lost. I have a questionaire form and when user clicks
Submit, I want to save the data in XML file on client side. User will
then sync all these xml files to a PC later. From all the research I
have done so far, its being indicated that client side file creation
is not possible - is that true? If yes, then I have a huge problem -
is there anyway I can create these files? Any suggestion would be
really appreciated. PLease remeber that I am novice to all this.
I've just assembled a nice malicious program and want to deploy it to
trillions of clients. Put it on a website named "free p**n" and have it
delivered via JS. Does this sound like something you want to encounter
in the wild?

Bottom line: You can't access the clients filesystem (IE-only ActiveX
components that can access the filesystem exist). You can return your
clients response to the server (via a form) and process the responses
there. No JS needed for that.

Gregor

--
http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie
http://web.gregorkofler.com ::: meine JS-Spielwiese
http://www.image2d.com ::: Bildagentur für den alpinen Raum
Jun 27 '08 #3
I should have also mentioned that this will not be available to
everyone.
My target user will be aware of the xml creations and that this will
be
used on a PDA. Maybe there is someother way to create them on PDA?
Sending
data each time he/she submits may be not be a feasible option - maynot
have connection, maybe out range. There has to be some way to save it
on
PDA, so that it can be sent later.

thanks
LS
On Jun 20, 5:59*am, Gregor Kofler <use...@gregorkofler.atwrote:
shailaja.sh...@gmail.com meinte:
Hi ,
This is my *first attempt to do some html/javascriptprogramming and I
am totally lost. I have a questionaire form and when user clicks
Submit, I want to save the data in XMLfileonclientside. User will
then sync all these xml files to a PC later. From all the research I
have done so far, its being indicated thatclientsidefilecreation
is not possible - is that true? If yes, then I have a huge problem -
is there anyway I cancreatethese files? Any suggestion would be
really appreciated. PLease remeber that I am novice to all this.

I've just assembled a nice malicious program and want to deploy it to
trillions of clients. Put it on a website named "free p**n" and have it
delivered via JS. Does this sound like something you want to encounter
in the wild?

Bottom line: You can't access the clients filesystem (IE-only ActiveX
components that can access the filesystem exist). You can return your
clients response to the server (via a form) and process the responses
there. No JS needed for that.

Gregor

--http://photo.gregorkofler.at::: Landschafts- und Reisefotografiehttp://web.gregorkofler.com*::: meine JS-Spielwiesehttp://www.image2d.com* ** ::: Bildagentur für den alpinen Raum
Jun 27 '08 #4
sh************@gmail.com writes:
This is my first attempt to do some html/javascript programming and I
am totally lost. I have a questionaire form and when user clicks
Submit, I want to save the data in XML file on client side.
As others have said, that is not generally possible.

There are ways around it that works in some browsers (or rather, there
are several ways around it that each work in one browser :), but at
least the user will be asked if the page should be allowed to access
the local disk.
If the user accepts, then it works, and if they are the ones to sync
later, then they'll probably cooperate.

TiddlyWiki can save itself in both IE and Mozilla/Firefox, and with
some setup also in Opera (and possibly other browsers too, as the
Opera solution uses Java). I looked at the code some time ago, and
with some fiddling, it should be possible to duplicate the effect.
See: http://www.tiddlywiki.com/#SaveChanges

Another option is to have the user install Google Gears, and store
the data in a database instead of a local file.

In either case, this will probably take an experienced programmer
some effort, so as a first-time user, you might be in over your
head.
/L
--
Lasse Reichstein Nielsen
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jun 27 '08 #5
Thank you all for your replies.

LS
Jun 27 '08 #6
GArlington wrote:
On Jun 20, 9:37 am, shailaja.sh...@gmail.com wrote:
>[...] From all the research I have done so far, its being indicated
that client side file creation is not possible - is that true?

Yes, you CAN NOT access client side file system with standard
javascript...
And what would this "standard javascript" of yours be?

BTW, your quoting sucks. --<http://www.jibbering.com/faq/#FAQ2_3>
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Jun 27 '08 #7
shailaja.sh...@gmail.com wrote:
This is my *first attempt to do some html/javascript programming and I
am totally lost. I have a questionaire form and when user clicks
Submit, I want to save the data in XML file on client side. User will
then sync all these xml files to a PC later. From all the research I
have done so far, its being indicated that client side file creation
is not possible - is that true? If yes, then I have a huge problem -
is there anyway I can create these files?
IE4+:

<iframe name="ifr" style="display:none; visibility:hidden"></iframe>
<form method="get" action="#" onSubmit="return false">
Email <input type="text" name="email" size="20"><br>
Tel <input type="text" name="tel" size="20"><br>
<input type="button" value="Save" onClick="
if (document.execCommand) {
var w = frames['ifr'].document;
w.open('text/xml', 'replace');
w.write('<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n'
+ '<root>\n'
+ ' <email>' + document.forms[0].email.value + '</email>\n'
+ ' <tel>' + document.forms[0].tel.value + '</tel>\n'
+ '</root>');
w.close() ;
w.execCommand('SaveAs', true, 'yourfilename.xml');
}
else {
alert('document.execCommand is only supported in MSIE4+.');
}
">
</form>

Hope this helps,

--
Bart
Jun 27 '08 #8
On Jun 23, 6:37 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
GArlington wrote:
On Jun 20, 9:37 am, shailaja.sh...@gmail.com wrote:
[...] From all the research I have done so far, its being indicated
that client side file creation is not possible - is that true?
Yes, you CAN NOT access client side file system with standard
javascript...

And what would this "standard javascript" of yours be?
I trust that MS Jscript (which is often referred to as javascript
[variant]) allows client file system access...
>
BTW, your quoting sucks. --<http://www.jibbering.com/faq/#FAQ2_3>
Thanks, I like it too...
>
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Jun 27 '08 #9
GArlington wrote:
Thomas 'PointedEars' Lahn wrote:
>GArlington wrote:
>>On Jun 20, 9:37 am, shailaja.sh...@gmail.com wrote:
[...] From all the research I have done so far, its being indicated
that client side file creation is not possible - is that true?
Yes, you CAN NOT access client side file system with standard
javascript...
And what would this "standard javascript" of yours be?
I trust that MS Jscript (which is often referred to as javascript
[variant]) allows client file system access...
[trolling snipped]
Please don't post here again until you have a minimum clue what you are
talking about (and learned how to quote properly). Thanks in advance.
Score adjusted

PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Surendra | last post by:
Hi to all, Can any one of u solve my problem. How can i show a message box on client side using class library of .net it may be vb.net or c#.net. If any1 has any idea about it. Please let me...
2
by: jcvoon | last post by:
Hi: It is possible to send a downloaded pdf file to fax printer using javascript ? something like this, but i can't make the following code work. function FaxDocument() { var faxServer =...
3
by: ABC | last post by:
How to debug client-side script (javascript) from VS2003 or VS2005?
2
by: krev | last post by:
Is is possible to check the version of a software installed in client system using javascript?
7
by: Ale | last post by:
can anyone plzzz tell how to store data at the client side using jsp's or servlets?
14
by: prashant | last post by:
hello, I am looking to determine the number of image files in a folder so that I could create a dynamic table accordingly. For this i need a method to identify the number of files in a folder. Is...
4
by: pskvenkat | last post by:
Hi this is venkat, i have a drop downlist for country, i composed a code in javascript for that and its working in HTML page but i dont know how to call the same javascript function in asp.net(C#)...
3
by: malathib | last post by:
Hi, In my web application, in one of the screen when the user clicks on one link, it has to open a folder that was located in server in client side.
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
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 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.