file_upload POST function

file_upload(p, load_el, out_el, append, restore, remove, popup_out, field_name, form_name, callback, replace)

This function sends GET request via AJAX without History.pushState() (no change to URL).

  • p - string | URL
  • load_el - string | Loader output element ID
  • out_el - string | AJAX-response output element ID
  • append - bool / string('prepend') | Append or Prepend to out_el element ID
  • restore - bool | Restore content in Loader (load_el) element after AJAX-request is done
  • remove - string | Element ID to remove after AJAX-request is done
  • popup_out - string / bool
  • field_name - string | ID attribute of input[type="file"]
  • form_name - string | Name attribute of input[type="file"]
  • callback - string / function | Callback function after AJAX-request is successfully done
  • replace - bool | If true element with id: out_el will be replaced by AJAX-response

Example

<input 	type="file" 
	id="upload_input" 
	name="pic" 
	onchange="$('#upload_button').trigger('click')">

<script type="text/javascript">
...
file_upload('/upload.php', 'loader_container', 'gallery', true, true, false, false, 'upload_input', 'pic', false, false);
...
</script>