Skip to content

Commit

Permalink
add upload file
Browse files Browse the repository at this point in the history
  • Loading branch information
LFsWang committed Mar 22, 2017
1 parent c429bca commit c7b233e
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions template/problem/problem_submit.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@
location.href="<?=$SkyOJ->uri('chal','result')?>/"+res.data;
});
});
function init()
{
var j_submit = $('#codesubmit');
$('#s_file').on('change',function(e)
{
var reader = new FileReader();
reader.onload = function(e)
{
var editor = ace.edit("editor");
editor.getSession().setValue(reader.result);
};
reader.readAsText(this.files[0]);
});
};
init();

})
</script>
<div class="container">
Expand All @@ -47,16 +63,19 @@
<?php endforeach; ?>
</select>
</div>

<div class="row">
<div class="col-sm-12">
<?php Render::renderCode('','c_cpp','editor',['minLines'=>20,'maxLines'=>20]); ?>
</div>
</div>
<div class="form-group">
<input type="file" id="s_file">
</div>
</form>
</div>
</div>

<div class="row">
<div class="col-sm-12">
<?php Render::renderCode('','c_cpp','editor',['minLines'=>20,'maxLines'=>20]); ?>
</div>
</div>


<div class="row" style = "margin-top:15px;">
<div class="col-sm-offset-6 col-sm-6 text-right">
Expand Down

0 comments on commit c7b233e

Please sign in to comment.