Start to accept files via standard upload in case of browser or user incompetence.
This commit is contained in:
parent
4322822906
commit
f5160b9916
3 changed files with 39 additions and 1 deletions
|
@ -6,7 +6,7 @@ class Upload extends CI_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process() {
|
public function process() {
|
||||||
header('Content-Type: application/json',true);
|
header('Content-Type: text/html',true); //application/json
|
||||||
|
|
||||||
$temp_name = md5(rand());
|
$temp_name = md5(rand());
|
||||||
|
|
||||||
|
|
|
@ -55,5 +55,41 @@
|
||||||
<script src="/js/jquery.altAlert.js"></script>
|
<script src="/js/jquery.altAlert.js"></script>
|
||||||
<script src="/js/jquery.filedrop.js"></script>
|
<script src="/js/jquery.filedrop.js"></script>
|
||||||
<script src="/js/upload.js"></script>
|
<script src="/js/upload.js"></script>
|
||||||
|
<script src="/js/jquery.upload-1.0.2.js"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function() {
|
||||||
|
$('#single_upload').change(function() {
|
||||||
|
$(this).upload('/upload/process/', function(response) {
|
||||||
|
|
||||||
|
if(response.type == 'error') {
|
||||||
|
alert('There was an error: ' + response.status);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
// $.data(file).addClass('done');
|
||||||
|
// $.data(file).find('.linkBox').val(response.file);
|
||||||
|
// $.data(file).find('.linkBox').click(function() {
|
||||||
|
// this.focus();
|
||||||
|
// this.select();
|
||||||
|
// });
|
||||||
|
$('#dropbox').append($('<div>')
|
||||||
|
.append($('<input>')
|
||||||
|
.attr('type', 'text')
|
||||||
|
.val(response.file)
|
||||||
|
.addClass('linkBox')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$('#dropbox').find('.linkBox:last').click(function() {
|
||||||
|
this.focus();
|
||||||
|
this.select();
|
||||||
|
});
|
||||||
|
alert('success');
|
||||||
|
}
|
||||||
|
|
||||||
|
}, 'json');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1,3 +1,5 @@
|
||||||
<div id="dropbox">
|
<div id="dropbox">
|
||||||
<span class="message">Drop images here to upload.</span>
|
<span class="message">Drop images here to upload.</span>
|
||||||
|
<br/><br/>
|
||||||
|
<center><input type="file" name="image" id="single_upload"></center>
|
||||||
</div>
|
</div>
|
Loading…
Reference in a new issue