1
0
Fork 0

Add text box for direct link after upload

This commit is contained in:
Doug Patti 2012-07-20 22:28:49 -04:00
parent 29426b45de
commit 413642eae9
3 changed files with 26 additions and 7 deletions

View file

@ -56,7 +56,12 @@ class Upload extends CI_Controller {
$this->image_lib->initialize($config); $this->image_lib->initialize($config);
$this->image_lib->resize(); $this->image_lib->resize();
$message = array('type'=>'success','status'=>'Uploaded successfully', 'file'=>base_url($file_name)); $message = array(
'type' => 'success',
'status' => 'Uploaded successfully',
'file' => base_url($file_name),
'direct' => base_url('uploads/' . $file_name . $upload['file_ext']),
);
} }
} }

View file

@ -209,7 +209,7 @@ h1{
height: 12px; height: 12px;
width: 100%; width: 100%;
left: 0; left: 0;
bottom: 30px; bottom: 55px;
box-shadow: 0 0 2px #000; box-shadow: 0 0 2px #000;
} }
@ -243,13 +243,22 @@ h1{
#dropbox .linkHolder { #dropbox .linkHolder {
padding-left: 20px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGWSURBVBgZpcE/a1NhGMbh3/OeN56cKq2Dp6AoCOKmk4uCn8DNycEOIojilr2TaBfRzVnESQR3Bz+FFDoWA2IjtkRqmpyc97k9qYl/IQV7XSaJw4g0VlZfP0m13dwepPbuiH85fyhyWCx4/ubxjU6kkdxWHt69VC6XpZlFBAhwJgwJJHAmRKorbj94ewvoRBrbuykvT5R2/+lLTp05Tp45STmEJYJBMAjByILxYeM9jzr3GCczGpHGYAQhRM6fO8uFy1fJQoaUwCKYEcwwC4QQaGUBd36KTDmQ523axTGQmEcIEBORKQfG1ZDxcA/MkBxXwj1ggCQyS9TVAMmZiUxJ8Ln/kS+9PmOvcSW+jrao0mmMH5bzHfa+9UGBmciUBJ+2Fmh1h+yTQCXSkJkdCrpd8btIwwEJQnaEkOXMk7XaiF8CUxL/JdKQOwb0Ntc5SG9zHXQNd/ZFGsaEeLa2ChjzXQcqZiKNxSL0vR4unVwwMENMCATib0ZdV+QtE41I42geXt1Ze3dlMNZFdw6Ut6CIvKBhkjiM79Pyq1YUmtkKAAAAAElFTkSuQmCC);
background-position: left center;
background-repeat: no-repeat;
position: absolute; position: absolute;
left: 0; left: 0;
bottom: 0; bottom: 25px;
width: 100%; width: 220px;
} }
#dropbox .linkHolder input { #dropbox .linkHolder.direct {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAADpSURBVCjPY/jPgB8y0EmBHXdWaeu7ef9rHuaY50jU3J33v/VdVqkdN1SBEZtP18T/L/7f/X/wf+O96kM3f9z9f+T/xP8+XUZsYAWGfsUfrr6L2Ob9J/X/pP+V/1P/e/+J2LbiYfEHQz+ICV1N3yen+3PZf977/9z/Q//X/rf/7M81Ob3pu1EXWIFuZvr7aSVBOx1/uf0PBEK3/46/gnZOK0l/r5sJVqCp6Xu99/2qt+v+T/9f+L8CSK77v+pt73vf65qaYAVqzPYGXvdTvmR/z/4ZHhfunP0p+3vKF6/79gZqzPQLSYoUAABKPQ+kpVV/igAAAABJRU5ErkJggg==);
bottom: 0;
}
#dropbox input {
width: 100%; width: 100%;
} }

View file

@ -16,12 +16,14 @@ $(function(){
alert('There was an error: ' + response.status); alert('There was an error: ' + response.status);
$.data(file).addClass('error'); $.data(file).addClass('error');
$.data(file).find('.linkBox').remove(); $.data(file).find('.linkBox').remove();
$.data(file).find('.directLinkBox').remove();
return false; return false;
} else { } else {
$.data(file).addClass('done'); $.data(file).addClass('done');
$.data(file).find('.linkBox').val(response.file); $.data(file).find('.linkBox').val(response.file);
$.data(file).find('.linkBox').click(function() { $.data(file).find('.directLinkBox').val(response.direct);
$.data(file).find('input').click(function() {
this.focus(); this.focus();
this.select(); this.select();
}); });
@ -77,6 +79,9 @@ $(function(){
'<div class="linkHolder">' + '<div class="linkHolder">' +
'<input type="text" class="linkBox" />' + '<input type="text" class="linkBox" />' +
'</div>' + '</div>' +
'<div class="direct linkHolder">' +
'<input type="text" class="directLinkBox" />' +
'</div>' +
'</div>'; '</div>';