5 Replies - 2012 Views - Last Post: 27 June 2012 - 04:57 AM

#1 fallenreaper  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 240
  • Joined: 19-June 10

having a client side image viewer work in IE

Posted 25 June 2012 - 01:15 PM

I was working on my latest javascript thing, and as a part of it, for userfriendlyness, I wanted to have the image appear when you want to upload it to the server. That way, the user would have something to see to further confirm what image they are indeed uploading.

I had worked a few ways around, but alas, i need to find a way for IE. Yes, MS, you really do get on our nerves sometimes. heh..

So, this is what i managed to do to get it working for google.
var data = $(input)[0];
var file = data.files[0];
var reader = new FileReader();
reader.onload = function (e) {
  value = e.target.result;
  try {
    top.document.getElementById('formDesignContents').contentwindow.updateFormFromToolbar(CURRENT_ATTRIBUTE, value, opts);
  } catch (err) {
    alert("error connecting to formDesignContents iframe from the toolbar");
  }
}
reader.readAsDataURL(file);
return;


And i want to the same for IE. Essentially, here is the idea about it.

I have a input(file) tag. the input tag will select an item. On change, it will take the image that it is pointing to for upload and store it in an image tag so the user can see it. There is NO pinging the server. This is all done client side, and i want it to stay that way.

I have 3 stackoverflow posts about this, if you want more information. Their links are below:

post 1
Post 2
ie does not like my images

edit: fixed a minor grammar issue

This post has been edited by fallenreaper: 25 June 2012 - 01:16 PM


Is This A Good Question/Topic? 0
  • +

Replies To: having a client side image viewer work in IE

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3485
  • View blog
  • Posts: 10,043
  • Joined: 08-June 10

Re: having a client side image viewer work in IE

Posted 26 June 2012 - 02:41 AM

for file access in IE you would have to use an ActiveX control. for IE9, MDN mentiones an MS FileAPI.
Was This Post Helpful? 0
  • +
  • -

#3 fallenreaper  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 240
  • Joined: 19-June 10

Re: having a client side image viewer work in IE

Posted 26 June 2012 - 05:30 AM

i was getting an error with an example i found
var filePath = $(input).attr("value");
var fso = new ActiveXObject("Scripting.FileSystemObject");  // <--crashes here
var textStream = fso.OpenTextFile(filePath);
var fileData = file.ReadAll();


and it crashes at the activeX object line.
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3485
  • View blog
  • Posts: 10,043
  • Joined: 08-June 10

Re: having a client side image viewer work in IE

Posted 26 June 2012 - 05:32 AM

cant tell you much about that as I practically never use IE. might be something with IEs rights management.
Was This Post Helpful? 0
  • +
  • -

#5 fallenreaper  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 240
  • Joined: 19-June 10

Re: having a client side image viewer work in IE

Posted 26 June 2012 - 08:03 AM

I had found another option then, as the thing i am trying to do is essentially have an image previewer before an upload, which worked with IE.

The site I had gotten my script from was: http://forums.digita...ad.php?t=509581

my adjusted script is the same with all but 1 thing... My <img> is not created and passed in a src, it was a preexisting item, which has had its source change. Thoughts? Ideas? the demo i linked, does exactly what i want but with components i do not need.
Was This Post Helpful? 0
  • +
  • -

#6 fallenreaper  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 240
  • Joined: 19-June 10

Re: having a client side image viewer work in IE

Posted 27 June 2012 - 04:57 AM

this topic has sort of been resolved.

It needs to be connected with an SSL server, so that there is trust. It seems that the images will not show because of the permissions, but if the site is trusted and secured, it works.

That is soooo stupid, but i dont know what else to say to fix it. Ill put up a box saying that if it is IE and not secure, if they want to view images, to click OK and refresh as https
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1