summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/views/file/upload_form.php4
-rw-r--r--data/js/upload_form.js5
2 files changed, 5 insertions, 4 deletions
diff --git a/application/views/file/upload_form.php b/application/views/file/upload_form.php
index 7ca0e2a13..5eea494e1 100644
--- a/application/views/file/upload_form.php
+++ b/application/views/file/upload_form.php
@@ -6,7 +6,6 @@
Optional password (for deletion and search): <input type="password" name="password" size="10" />
</p>
</form>
- <script type="text/javascript" src="<?php echo base_url(); ?>data/js/upload_form.js?<?php echo filemtime(FCPATH."/data/js/upload_form.js"); ?>"></script>
<script type="text/javascript">
/* <![CDATA[ */
document.write('\
@@ -20,8 +19,11 @@ document.write('\
</p>\
</form>\
');
+ var upload_url = "<?php echo site_url("file/do_upload/dumb"); ?>";
+ var max_upload_size = "<?php echo $max_upload_size; ?>";
/* ]]> */
</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): ?>
diff --git a/data/js/upload_form.js b/data/js/upload_form.js
index 0dcb53708..598d86465 100644
--- a/data/js/upload_form.js
+++ b/data/js/upload_form.js
@@ -2,7 +2,7 @@
if (window.File && window.FileList) {
function checkFileUpload(evt) {
var f = evt.target.files[0];
- if (f.size > <?php echo $max_upload_size; ?>) {
+ if (f.size > max_upload_size) {
document.getElementById('upload_button').value = "File too big";
document.getElementById('upload_button').disabled = true;
} else {
@@ -40,7 +40,6 @@ function gen_boundary() {
}
function do_paste() {
var http = new XMLHttpRequest();
- var url = "<?php echo site_url("file/do_upload/dumb"); ?>";
var CRLF = "\r\n";
var boundary = "--" + gen_boundary();
var body = "--" + boundary + CRLF
@@ -49,7 +48,7 @@ function do_paste() {
+ CRLF
+ document.getElementById("textarea").value + CRLF
+ "--" + boundary + "--" + CRLF + CRLF;
- http.open("POST", url, true);
+ http.open("POST", upload_url, true);
//Send the proper header information along with the request
http.setRequestHeader("Content-type", "multipart/form-data; boundary=" + boundary);