How to get some java image uploader source code?

Asked By 70 points N/A Posted on -
qa-featured

Hello experts,

A source for matter for java programming language, how to get some java image up loader source code?

Give me an additional information for this kind of matter I know you got some opinions about java programming language and related to source codes.

Thank you programmers.

SHARE
Best Answer by Cristina McCormick
Best Answer
Best Answer
Answered By 0 points N/A #181605

How to get some java image uploader source code?

qa-featured

Try Below Code. It have two step .

Step 1 : Paste this code into the HEAD of HTML document 

<HEAD>

<script type="text/javascript">
<!– Begin
  // width to resize large images to
var maxWidth=100;
  // height to resize large images to
var maxHeight=100;
  // valid file types
var fileTypes=["bmp","gif","png","jpg","jpeg"];
  // the id of the preview image tag
var outImage="previewField";
  // what to display when the image is not valid
var defaultPic="spacer.gif";

function preview(what){
  var source=what.value;
  var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
  for (var i=0; i<fileTypes.length; i++) if (fileTypes[i]==ext) break;
  globalPic=new Image();
  if (i<fileTypes.length) globalPic.src=source;
  else {
    globalPic.src=defaultPic;
    alert("THAT IS NOT A VALID IMAGEnPlease load an image with an extension of one of the following:nn"+fileTypes.join(", "));
  }
  setTimeout("applyChanges()",200);
}
var globalPic;
function applyChanges(){
  var field=document.getElementById(outImage);
  var x=parseInt(globalPic.width);
  var y=parseInt(globalPic.height);
  if (x>maxWidth) {
    y*=maxWidth/x;
    x=maxWidth;
  }
  if (y>maxHeight) {
    x*=maxHeight/y;
    y=maxHeight;
  }
  field.style.display=(x<1 || y<1)?"none":"";
  field.src=globalPic.src;
  field.width=x;
  field.height=y;
}
// End –>
</script>
</HEAD>

Step 2: Copy this code into the BODY of  HTML document 

<BODY>

<div align="center" style="line-height: 1.9em;">
Test it by locating a valid file on your hard drive:
<br>
<input type="file" id="picField" onchange="preview(this)">
<br>
<img alt="Graphic will preview here" id="previewField" src="spacer.gif">
<br> <div style="font-size: 7pt;">
</div>
 

Answered By 0 points N/A #181606

How to get some java image uploader source code?

qa-featured

Hi Kristen James,

You may Check the link below that I have attached for the Java codes regarding with image upload.

I think it was understandable and better than other codes that I've seen. 

Rose Indian: Upload Image Java Source Code

Hope that it would be helpful for your problem.

Thanks and more powers.

 

 

Login/Register to Answer

Related Questions