I am using uploading(img) process in my app using paperclip. My new
requirement is to preview before submitting.
My new requirement works only in FIREFOX not in IE,CHROME,SAFARI. My
code looks this.
<%= form.file_field :image, :onchange=> "setImage(this);" %>
function setImage(file) {
if(document.all)
document.getElementById('prevImage').src = file.value;
else
document.getElementById('prevImage').src =
file.files.item(0).getAsDataURL();
if(document.getElementById('prevImage').src.length > 0)
document.getElementById('prevImage').style.display =
'block';
}
Thanks in Advance
Mathew
--
Posted via http://www.ruby-forum.com/.
This issue corresponds to javascript+css concept only.
In that case a Ruby on Rails mailing list may not be the best place to get help.
But in your situation the first thing I would try is to run it in
firebug in firefox to check for errors. Also paste the complete page
html into the w3c html validator to check for valid html. Differences
between browsers is often caused by invalid html.
Colin
Thanks Colin for your idea..
I have checked my HTML that has some errors.
But now i changed. It is valid now but the issue remains the same.
>
> And running it with firebug in firefox?
>
I didnt see any errors in firebug.
I have tried another script right now. it is working in
ubuntu(firefox,chrome)..
I have to check the windows os and will update it.
thanks once again.