473,378 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Way to Retrieve file through Web service???

How can i recevice a file from server through web service or any other
method with a javascript code at client side??? The file list is
displayed and on click of button that particular file assosiated with
that button should be retrieved to the client from server.

Sep 28 '06 #1
3 1587

Saurabh wrote:
How can i recevice a file from server through web service or any other
method with a javascript code at client side??? The file list is
displayed and on click of button that particular file assosiated with
that button should be retrieved to the client from server.
You say retrieved. I assume then that you mean to have the client
download the specified file from the server?

If so, then simply do one of the following:

1. Provide anchors with the files' URL as the href attribute, or
2. If you want a button to initiate download then there are two
options:
A. Create a form for each file with the file's URL set as the action
attribute, or
B. Create a button for each file with the following onclick handler:
<input type="button" value="File1"
onclick="document.location=file1_url;"/>
Simple replace File1 with the filename and file1_url with the file's
url.

If downloading the file was not your goal, please let us know.

HTH

Sep 28 '06 #2
function GetList()
{
var strHTML = "<TABLE align=center>";
var servicename="GetList";
var ReplyXML = XmlhttpCall(servicename);
var Oxml = new ActiveXObject("Microsoft.XMLDOM");
Oxml.loadXML(ReplyXML);
var ODoc = Oxml.documentElement;
var outerCount = ODoc.childNodes.length;
var filename="";
var path="";
for(var i = 0; i < outerCount; i++)
{
strHTML = strHTML + "<TR><TH
colspan='2'>"+ODoc.childNodes[i].getAttribute("NAME")+"</TH></TR>";
for(var j = 0; j <
ODoc.selectNodes("/ROOT/DIRECTORY")[i].childNodes.length; j++)
{
filename =
ODoc.selectNodes("/ROOT/DIRECTORY")[i].childNodes[j].text;
path = ODoc.childNodes[i].getAttribute("NAME")+"','"+filename;
strHTML += "<TR><TD>"+filename+"</TD>";
strHTML += "<TD><input type='button' value='Read' id=btn"+i+j;
strHTML += " style='FONT-WEIGHT: bold; COLOR: blue;
BORDER-TOP-STYLE: none; FONT-FAMILY: Arial; BORDER-RIGHT-STYLE: none;
BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; FONT-VARIANT:
small-caps; BORDER-BOTTOM-STYLE: none'";
strHTML += "title='Click to Read/Open document'
onclick=\"Read('"+path+"')\"></TD></TR>";
}
}
strHTML = strHTML + "</TABLE>";
displayHTML.innerHTML = strHTML;
}

Sep 30 '06 #3
for(var j = 0; j <
ODoc.selectNodes("/ROOT/DIRECTORY")[i].childNodes.length; j++)
{
filename =
ODoc.selectNodes("/ROOT/DIRECTORY")[i].childNodes[j].text;
path = ODoc.childNodes[i].getAttribute("NAME")+"','"+filename;
strHTML += "<TR><TD>"+filename+"</TD>";
strHTML += "<TD><input type='button' value='Read' id=btn"+i+j;
strHTML += " style='FONT-WEIGHT: bold; COLOR: blue;
BORDER-TOP-STYLE: none; FONT-FAMILY: Arial; BORDER-RIGHT-STYLE: none;
BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; FONT-VARIANT:
small-caps; BORDER-BOTTOM-STYLE: none'";
strHTML += "title='Click to Read/Open document'
onclick=\"Read('"+path+"')\"></TD></TR>";
}

this is how i am generating a dynamic HTML.
can you elaborate a more on file url????

Sep 30 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: jacob navia | last post by:
Recently there was a discussion in this group about how to retrieve the file name given a FILE *. The question raised my curiosity, and after some research I have come up with a good...
2
by: SteveR | last post by:
I want to return an ArrayList from my web service. I can write this part and everything compiles but I can't get the web application that uses the web service to compile. I call the service...
3
by: Asus | last post by:
Hello, I'm new to Web Services. I'm trying to develop a Web Service that retrieves some data out of a database and sends them to the client as a DataSet when a method is invoked. My question...
1
by: John Yung | last post by:
Hi, I have a client (C# MS Excel Project) calling a Web Service to retrieve and update data. One of the business requirement is the client's NT Login ID, IP Address and computer name must be log...
2
by: Dedalus | last post by:
If I want to retrieve a full version information for an ms access databases, I use (from vb6 code) the "Access.Application" object and SysCmd method. Whit the number returned by the method I can...
7
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file...
12
lifeisgreat20009
by: lifeisgreat20009 | last post by:
I am a newbie to Struts and JSP...I have been working on the code below for 5 hours now..I googled a lot but couldn't get much help so finally I am here.. Hoping of getting my problem solved. Please...
7
by: KiranJyothi | last post by:
Hello All, I have one assignment in which I am given the String object (which contains the xml filecontents) and a key tag (which can be tag of the xml file). I have to return the tag contents....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.