summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/controllers/file.php3
-rw-r--r--application/views/file/upload_form.php40
2 files changed, 22 insertions, 21 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php
index edf7e0315..44f691dec 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -200,8 +200,7 @@ class File extends CI_Controller {
$data = array();
if ($this->uri->segment(3)) {
- $this->var->cli_client = true;
- $this->var->view_dir = "file_plaintext";
+ exit;
}
$extension = $this->input->post('extension');
diff --git a/application/views/file/upload_form.php b/application/views/file/upload_form.php
index 9b2115cb0..01fbc5ffa 100644
--- a/application/views/file/upload_form.php
+++ b/application/views/file/upload_form.php
@@ -8,33 +8,35 @@
</form>
<script type="text/javascript">
/* <![CDATA[ */
-document.write('\
- <p><b>OR</b></p>\
- <form action="javascript: do_paste()">\
- <p>\
- <textarea id="textarea" name="content" cols="80" rows="20"></textarea><br />\
- <div style="display: none">Email: <input type="text" name="email" size="20" /></div>\
- Optional password (for deletion and search): <input id="textarea_password" type="password" name="password" size="10" /><br />\
- <input type="submit" value="Paste" name="process" />\
- </p>\
- </form>\
-');
- var upload_url = "<?php echo site_url("file/do_upload/dumb"); ?>";
- var max_upload_size = "<?php echo $max_upload_size; ?>";
- /* ]]> */
+ var max_upload_size = "<?php echo $max_upload_size; ?>";
+ // check file size before uploading if browser support html5
+ if (window.File && window.FileList) {
+ function checkFileUpload(evt) {
+ var f = evt.target.files[0];
+ if (f.size > max_upload_size) {
+ document.getElementById('upload_button').value = "File too big";
+ document.getElementById('upload_button').disabled = true;
+ } else {
+ document.getElementById('upload_button').value = "Upload";
+ document.getElementById('upload_button').disabled = false;
+ }
+ }
+
+ document.getElementById('file').addEventListener('change', checkFileUpload, false);
+ }
+ /* ]]> */
</script>
- <script type="text/javascript" src="<?php echo base_url(); ?>data/js/upload_form.js?<?php echo filemtime(FCPATH."/data/js/upload_form.js"); ?>"></script>
</div>
<br />
-<p>Uploads/pastes are deleted after <?php echo $upload_max_age; ?> days<?php if($small_upload_size > 0): ?>
+<p>Uploads are deleted after <?php echo $upload_max_age; ?> days<?php if($small_upload_size > 0): ?>
unless they are smaller than <?php echo format_bytes($small_upload_size); ?>
<?php endif; ?>. Maximum upload size is <?php echo format_bytes($max_upload_size); ?></p>
<p><h2>Features</h2></p>
-<p>For shell uploading/pasting and download information for the client go to <a href="<?php echo site_url("file/client"); ?>"><?php echo site_url("file/client"); ?></a></p>
+<p>For shell uploading and download information for the client go to <a href="<?php echo site_url("file/client"); ?>"><?php echo site_url("file/client"); ?></a></p>
<p>You can use the <?php echo anchor("file/upload_history", "history"); ?> to find old uploads using the password supplied when creating the upload.</p>
-<p>How to link your pastes:</p>
+<p>How to link your uploads:</p>
<ul>
- <li><span class="example">/&lt;ID&gt;/</span> automatically highlight the paste</li>
+ <li><span class="example">/&lt;ID&gt;/</span> automatically highlight the uploads</li>
<li><span class="example">/&lt;ID&gt;</span> set the detected MIME type and let the browser do the rest</li>
<li><span class="example">/&lt;ID&gt;/plain</span> force the MIME type to be text/plain</li>
<li><span class="example">/&lt;ID&gt;/&lt;file extension&gt;</span> override auto detection and use the supplied file extension or language name for highlighting</li>