##// END OF EJS Templates
file-upload: allow specfing custom filename for uploaded archives.
marcink -
r1683:b17a8f3c default
parent child Browse files
Show More
@@ -660,7 +660,6 b' class FilesController(BaseRepoController'
660 file_obj = r_post.get('upload_file', None)
660 file_obj = r_post.get('upload_file', None)
661
661
662 if file_obj is not None and hasattr(file_obj, 'filename'):
662 if file_obj is not None and hasattr(file_obj, 'filename'):
663 filename = file_obj.filename
664 content = file_obj.file
663 content = file_obj.file
665
664
666 if hasattr(content, 'file'):
665 if hasattr(content, 'file'):
@@ -2008,6 +2008,10 b' BIN_FILENODE = 7'
2008 input {
2008 input {
2009 display: none;
2009 display: none;
2010 }
2010 }
2011 margin-top: 10px;
2012 }
2013 .file-upload-label {
2014 margin-top: 10px;
2011 }
2015 }
2012 p {
2016 p {
2013 margin-top: 5px;
2017 margin-top: 5px;
@@ -56,11 +56,17 b''
56 </div>
56 </div>
57 <div id="upload_file_container" class="fieldset" style="display: none;">
57 <div id="upload_file_container" class="fieldset" style="display: none;">
58 <div class="filename-label left-label">
58 <div class="filename-label left-label">
59 ${_('Filename')}:
60 </div>
61 <div class="right-content">
62 <input class="input-small" type="text" value="" size="46" name="filename" id="filename_upload" placeholder="${_('No file selected')}">
63 </div>
64 <div class="filename-label left-label file-upload-label">
59 ${_('Upload file')}:
65 ${_('Upload file')}:
60 </div>
66 </div>
61 <div class="right-content file-upload-input">
67 <div class="right-content file-upload-input">
62 <label for="upload_file" class="btn btn-default">Browse</label>
68 <label for="upload_file" class="btn btn-default">Browse</label>
63 <span id="selected-file">${_('No file selected')}</span>
69
64 <input type="file" name="upload_file" id="upload_file">
70 <input type="file" name="upload_file" id="upload_file">
65 <p>${_('or')} <a id="file_enable" href="#">${_('Create New File')}</a></p>
71 <p>${_('or')} <a id="file_enable" href="#">${_('Create New File')}</a></p>
66 </div>
72 </div>
@@ -155,10 +161,8 b''
155 });
161 });
156
162
157 $('#upload_file').on('change', function() {
163 $('#upload_file').on('change', function() {
158 if (detectIE() && detectIE() <= 9) {
159 if (this.files && this.files[0]) {
164 if (this.files && this.files[0]) {
160 $('#selected-file').html(this.files[0].name);
165 $('#filename_upload').val(this.files[0].name);
161 }
162 }
166 }
163 });
167 });
164
168
General Comments 0
You need to be logged in to leave comments. Login now