0

Hi i have the image selector control for selecting the image after that uploading it to the server. And i have to preview the selected image in the same page which is working fine in all browser but not in safari (my version 5.1.7). here is my code. please help to resolve this thanks in advance.

jQuery('#image').on('change', function () 
{
  ext = jQuery(this).val().split('.').pop().toLowerCase();
  if (jQuery.inArray(ext, ['gif', 'png', 'jpg', 'jpeg']) == -1) {
   resetFormElement(jQuery(this));
   window.alert('Not an image!');
  }
  else
  {
    file = jQuery('#image').prop("files")[0];
    blobURL = window.URL.createObjectURL(file);
    jQuery('#image_preview img').attr('src', blobURL);
    jQuery('#image_preview').slideDown();
    jQuery(this).slideUp();
  }
});
Tamil Selvan C
  • 19,913
  • 12
  • 49
  • 70
Innovative Thinker
  • 1,735
  • 2
  • 14
  • 24

1 Answers1

2

You need Safari 6

Browser compatibility

Chrome          Firefox (Gecko) IE      Opera           Safari (WebKit)
8 (webkitURL 23)    4.0 (2)     10      15 webkitURL    6 webkitURL

Here is an older way of doing it that may help

Image Upload with Preview and Delete

Community
  • 1
  • 1
mplungjan
  • 169,008
  • 28
  • 173
  • 236