これはかなり古いですが、私は現在、同じ問題を解決しているので、とにかく答えると思っていました。これを行う正しい方法は、変更されたファイルをキー/値ストアに保存することです(Web Storage - http://www.w3.org/TR/webstorage/)。
元のファイルを置き換える必要がある場合は、Webサーバーを経由して、変更されたファイルをWebサーバー上の正しいURLに配置または送信する必要があります。これは、ファイルを取得して保存するための簡単なバックエンドを作成することを意味します。ここで
は、単純なストレージ・コードです - あなたは、コード内の適切な場所にあるファイルとファイル名にURLを挿入する必要があります:
<!DOCTYPE html>
<html>
<head>
<title>File editor</title>
<script src="http://www.google.com/jsapi"></script>
<script>
google.load("jquery", "1.4.1");
</script>
<script>
$(document).ready(function() {
// check to see if we have it in storage already
if (file = localStorage.getItem('<filename>')) {
$("textarea[id='edit_box']").val(file);
} else { // get it from the url
$.get("<url to file>", null, function(data)
{
$("textarea[id='edit_box']").val(data);
}, "text");
}
// save to storage
$("textarea[id='edit_box']").bind('keyup', function() {
localStorage.setItem('<filename>', this.value);
});
});
</script>
</head>
<body>
<form method="get" id="edit_file">
<input type="file"></input>
<div id="edit">
<textarea id="edit_box" placeholder="Type here" cols="80" rows="50"></textarea>
</div>
</body>
</html>
出典
2011-11-18 00:07:50
Guy
だけでなく、フラッシュがまったく行くではありません。私はこのプロジェクトにhtml5技術を使う必要があります – boris