File: WIAdmin/WICore/WIJ/WIUpload_file.js

Recommend this page to a friend!
  Classes of Jules Warner  >  WICMS  >  WIAdmin/WICore/WIJ/WIUpload_file.js  >  Download  
File: WIAdmin/WICore/WIJ/WIUpload_file.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: WICMS
Database driven content management system with PDO
Author: By
Last change:
Date: 3 years ago
Size: 1,778 bytes


Class file image Download
$(document).ready(function (event) {

$("#wiupload").on('submit',(function(event) {
url: "WICore/WIClass/WIAjax.php", // Url to which the request is send
type: "POST",             // Type of request to be send, called as method
data: {
	action : header_upload,
	upload : new FormData(this)
}, // Data sent to server, a set of key/value pairs (i.e. form fields and values)
contentType: false,       // The content type used when sending data to the server.
cache: false,             // To unable request pages to be cached
processData:false,        // To send DOMDocument or non processed data file it is set to false
success: function(data)   // A function to be called if request succeeds

// Function to preview image after validation
$(function() {
$("#file").change(function(event) {

$("#message").empty(); // To remove the previous error message
var file = this.files[0];
var imagefile = file.type;
var match= ["image/jpeg","image/png","image/jpg"];
if(!((imagefile==match[0]) || (imagefile==match[1]) || (imagefile==match[2])))
$("#message").html("<p id='error'>Please Select A valid Image File</p>"+"<h4>Note</h4>"+"<span id='error_message'>Only jpeg, jpg and png Images type allowed</span>");
return false;
var reader = new FileReader();
reader.onload = imageIsLoaded;
function imageIsLoaded(e) {
$('#image_preview').css("display", "block");
$('#previewing').attr('width', '250px');
$('#previewing').attr('height', '230px');

For more information send a message to info at phpclasses dot org.