Jump to content

Local XML-file: loading and saving in WebService


Gerb 233
 Share

Recommended Posts

Hello,I have made a WebService in HTML & JavaScript. The user can edit data in this WebService, but before that a XML-file must be loaded. After the user has edited the data, the XML-file has to be saved.I want to let the user load a local (on local hard-drive) XML-file and after editing, save the XML-file to the local hard drive.My question is: how can I do that, without having security problems in the browser?Thanks in advance!Regards,Gerben

Link to comment
Share on other sites

I've never heard of a web service using HTML and JS, but anyway...You can use a server-side language such as PHP to allow the user to upload files to your server for editing, but you cannot save the file back as websites cannot access or write to the local filesystem. The best you can do is output the XML file and prompt the user to "Save As".

Link to comment
Share on other sites

I've never heard of a web service using HTML and JS, but anyway...You can use a server-side language such as PHP to allow the user to upload files to your server for editing, but you cannot save the file back as websites cannot access or write to the local filesystem. The best you can do is output the XML file and prompt the user to "Save As".
Thank you Synook!It think I get the idea:1. Upload file in PHP2. Edit the data in JavaScript (I allready got the JavaScript)3. Output the XML-file in PHP.Do you know a place where I can find example code for this. This would really help.Regards,Gerben
Link to comment
Share on other sites

1. Upload file in PHP
http://au2.php.net/manual/en/features.file-upload.php
2. Edit the data in JavaScript (I allready got the JavaScript)
Basically you get the contents of the file through PHP and echo it into the contents of a form with a textarea.
3. Output the XML-file in PHP.
http://au2.php.net/manual/en/reserved.vari....variables.posthttp://au2.php.net/manual/en/function.echo.php
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...