Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!

nanu shah

Greenhorn
+ Follow
since Apr 07, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by nanu shah

Thanks Eric Pascarello and Bear Bibeault
For your instant reply and guiding me.... I have found the resolution to get the file name through the Javascript, its the following code...


<%@page import=" javax.servlet.ServletRequest" %>
<html>
<head>
<title>JSP Page</title>
<script type="text/javascript">
function ViewImage(filename)
{

var imageview = document.getElementById('ImageView');
imageview.innerHTML += '

' +filename.value+'

';

}
</script>
</head>
<body>
<h1>Hello World!</h1>


<div id="ImageView"></div>
File needed to upload
<input type="File" name="Browse" id="browse" onchange="ViewImage(this);" >

</body>
</html>


But Now i have one more problem... i want to write a javascript in a way that i can view the word document and pdf document on same webpage.... So please guide me ahead or suggest me what need to do ahead...?


i am using following code but its opening in microsoft word and also not displaying me the document.
<script type="text/javascript">
function ViewImage(filename)
{
var imageview = document.getElementById('ImageView');
imageview.innerHTML += '

' +filename.value+'

';
openWordDocPath(filename);
}

function openWordDocPath(strLocation)
{
var objWord;

var imageview = document.getElementById('ImageView');
imageview.innerHTML += '

' +strLocation+'

';
objWord = new ActiveXObject("Word.Application");
objWord.Visible = true;

var imageview = document.getElementById('ImageView');
imageview.innerHTML += '

' +strLocation+'

';
objWord.Documents.Open(strLocation);

}
</script>

please help me...

thanks
Eric

Browse is the id of the input type "File"
hi Bear Bibeault,

i apology for this... I tried to search for javascripts but could not find it. So and i was thinking to implement this thing using jsp that why i posted over here...

Now actually i want to display the doc and pdf file on same webpage... I was thinking that if i can get the filename from local machine that i can covert it into jpg format to display it on same webpage.

if you can suggest me any other alternative, i would be thankful to you...

Thanks
Hi,


i need to get the value of input type file, i.e. selected from local machine to variable... its not giving me the error but its not running it.

following is my code i am running


<%@page import=" javax.servlet.ServletRequest" %>
<html>
<head>
<title>JSP Page</title>
<script type="text/javascript">
function ViewImage()
{
var userInput = document.getElementById('userInput');

// 1). I tried using following one :
var filename= document.getElementById(browse);
imageview.innerHTML += '

hello

' + filename.value + '

';


var imageview = document.getElementById('ImageView');
imageview.innerHTML += '

' + userInput.value + '

';

/* 2). Also tried using this one too.
var files = $'input[type="File"]';
imageview.innerHTML += '

hello

' + files.value + '

';*/

/* 3). tried using this too
String filename= request.getParameter(browse);
imageview.innerHTML += '

hello

' + filename.value + '

';
*/
}
</script>
</head>
<body>
<h1>Hello World!</h1>


<div id="ImageView"></div>

<input type="text" name="userInput" id="userInput"/>

File needed to upload
<input type="File" name="Browse" id="browse" onclick="ViewImage();" >

<!-- <button type="button" name="submit" onclick="ViewImage();"> Submit
</button> -->

</body>
</html>

i tried all the possibilties that i can find on internet. But i didnt get the output of it. but its shows output if i enable the button tag. please suggest the solution. i want the whole path and name of file uploading.
hi...
i am ronak shah studing in computer enggineerings in india....i want a help from you all...can you suggest me a idea to develop the project in java with a new ideas....i need it....so please suggest me some new idea which could be implmented using java...thanks
13 years ago
hi...
i am ronak shah studing in computer enggineerings in india....i want a help from you all...can you suggest me a idea to develop the project in java with a new ideas....i need it....so please suggest me some new idea which could be implmented using java...thanks
13 years ago