0

So I'm developing this site that analyse specific data files (that are in XML). I'm lost at how to replace the old data with the new uploaded data.

So lets say I create this button:

<input id="upload" type="file">

But I do not want the file to actually be uploaded anywhere but rather just read so it would take the content of the XML uploaded and replace the content of an existing XML. How would I do that? I'm absolutely lost

For example:

Lets say I had an old datafile called old.xml

<data>
    <file desc="test1">
        <content>1</content>
    </file>
</data>

And someone uploaded the following XML (which is not stored but rather just read) that contained:

<data>
    <file desc="test2">
        <content>2</content>
    </file>
    <file desc="test3">
        <content>3</content>
    </file>
</data>

What I would want is that old.xml is entire replaced by the uploaded XML.

JooHyun
  • 37
  • 1
  • 4

1 Answers1

0

JavaScript alone won't be able to edit a file.

Since you mentioned PHP, here are some links to get you started on 'learning':

Community
  • 1
  • 1
Ethan
  • 446
  • 3
  • 13