473,656 Members | 2,997 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using PUT with XMLHTTP

Hi,

Do you know if it is possible to use the PUT method with the XMLHTTP
object and if yes what the client side code should look like?

I would like to PUT a file on the server. I got stuck here:

var ajax = new_ajax_obj();
ajax.open ('PUT', file, true);
ajax.send ('');

I failed to find a good documentation of the "send" method so that I
can specify a particular file.

Any help will be appreciated.

--
Kamen TOMOV
Jan 23 '06 #1
15 6865
To the best of my knowledge you cannot use PUT with the XmlHTTP object.
:-(

Sorry.

If you find out how, I'd love to know.

I've been using an iFrame for a similar effect.

Jan 24 '06 #2
Kamen TOMOV wrote:
Do you know if it is possible to use the PUT method with the XMLHTTP
object
The IXMLHTTPRequest interface reference[1] says it is possible, the XUL
Object Reference[2] says it is not. I have never tried anything else
than GET or POST to date.
and if yes what the client side code should look like?
I would like to PUT a file on the server. I got stuck here:

var ajax = new_ajax_obj();
ajax.open ('PUT', file, true);
ajax.send ('');

I failed to find a good documentation of the "send" method so that I
can specify a particular file.


You cannot specify a particular file there. If you want to use PUT, you
need a HTTP server and a resource that supports it (indicated by an
"Allow: ...,PUT" response header) and send it the _content_ of the file
you want to replace the resource with as the request body [as argument of
send()]. See RFC1945 (HTTP/1.0), appendix D, subsection 1.1.[3], and
RFC2616 (HTTP/1.1), subsection 9.6.[4] You will need additional host
objects for file access to retrieve that file content.[5]
HTH

PointedEars
___________
[1]
<URL:http://msdn.microsoft. com/library/en-us/xmlsdk/html/7924f6be-c035-411f-acd2-79de7a711b38.as p>
[2]
<URL:http://xulplanet.com/references/objref/XMLHttpRequest. html#method_ope n>
[3] <URL:http://www.rfc-editor.org/rfc/rfc1945.txt>
[4] <URL:http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html>
[5] <URL:http://xulplanet.com/references/xpcomref/group_Files.htm l>
<URL:http://msdn.microsoft. com/library/en-us/script56/html/jsobjfilesystem .asp>
Jan 24 '06 #3
On Tue, Jan 24 2006, Thomas 'PointedEars' Lahn wrote:
You will need additional host objects for file access to retrieve
that file content.[5]
..


And is there a generic JavaScript functionality that could be used for
reading a file beside using XUL?

Thank you.

--
Kamen TOMOV
Jan 24 '06 #4
VK

Kamen TOMOV wrote:
And is there a generic JavaScript functionality that could be used for
reading a file beside using XUL?

Thank you.


XPConnect (Gecko) / FileSystemObjec t (IE)

But FileSystemObjec t allows you to read only text files (TXT, XML,
HTTP). For binary files you're getting only file header. So no, there
is nothing universal / generic: except <input type="file"> and file
upload over HTTP in base64. This is fully universal and I'm affraid
this is what you'll have to live with for now. At least until any other
browser besides Amaya will support PUT method (I wouldn't count on it
too much).

Jan 24 '06 #5
Kamen TOMOV wrote:
On Tue, Jan 24 2006, Thomas 'PointedEars' Lahn wrote:
You will need additional host objects for file access to retrieve
that file content.[5]
..


And is there a generic JavaScript functionality that could be used for
reading a file beside using XUL?


As I said you have to use host objects for filesystem access (because
neither language discussed here provides for that feature natively). It is
possible to implement a generic interface with JS/ECMAScript to provide for
transparent file system access through it if either host object is
supported, but of course JavaScript does not provide for such an interface
natively.

It should be added that XMLHTTPRequest itself (which refers to another host
object) can provide for _read_ access to file content even if the local
system is not running a Web server, so you do not need the FileSystemObjec t
object or XUL filesystem objects for that necessarily; however, the Same
Origin Policy and other security restrictions apply in that case, too.

Please use _all_ the URLs I have provided and get informed first. Come back
again (and continue _this_ thread) if you have specific problems in making
your approach work.

<URL:http://jibbering.com/faq/>
PointedEars
Jan 24 '06 #6
On 2006-01-23, Kamen TOMOV <ka***@evrocom. net> wrote:
Hi,

Do you know if it is possible to use the PUT method with the XMLHTTP
object and if yes what the client side code should look like?

I would like to PUT a file on the server. I got stuck here:

var ajax = new_ajax_obj();
ajax.open ('PUT', file, true);
ajax.send ('');

I failed to find a good documentation of the "send" method so that I
can specify a particular file.

Any help will be appreciated.


PUT is not well supported (by servers), file uploads are usually done
using POST with multipart content and CGI support on ther server.
--

Bye.
Jasen
Jan 25 '06 #7
VK

Jasen Betts wrote:
PUT is not well supported (by servers), file uploads are usually done
using POST with multipart content and CGI support on ther server.


PUT is not supported *by current browsers* (except Amaya, but this W3C
ugly baby is not usable for browsing).

On the server side you can instruct server to accept even FOOBAR
requests if you want to, so again - it's the limitation from the client
side.

Jan 25 '06 #8
VK wrote:
Jasen Betts wrote:
PUT is not well supported (by servers), file uploads are usually done
using POST with multipart content and CGI support on ther server.
PUT is not supported *by current browsers*


Nonsense.
(except Amaya, but this W3C ugly baby is not usable for browsing).
Fortunately, you do not set the standards for the Web.
On the server side you can instruct server to accept even FOOBAR
requests
That would not be a _HTTP_ server anymore.
if you want to, so again - it's the limitation from the client side.


No, it is not. Learn to understand the difference between (HTTP) clients
and browsers.
PointedEars
Jan 25 '06 #9
VK

Thomas 'PointedEars' Lahn wrote:
VK wrote:
Jasen Betts wrote:
PUT is not well supported (by servers), file uploads are usually done
using POST with multipart content and CGI support on ther server.


PUT is not supported *by current browsers*


Nonsense.


Then please post here a *working* sample of PUT request using Firefox,
IE, Opera, Netscape, Camino, Safari (*any* of these, you don't need to
cover all of them).

A hint: you can do it with NCSA Mosaic, Netscape Composer (4.x package)
and W3C Amaya. What is the difference? That's your homework.

P.S. By "working sample" I did not mean a whole separate application
with an open interface accessed over JavaScript/JScript from a browser
page. This way JavaScript is capable for everything in the world: known
and unknown :-)

Jan 25 '06 #10

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

Similar topics

9
5556
by: fochie | last post by:
Greetings, I'm having a problem when I try to GET a file from my server via xmlhttp when using Mozilla. With IE I can get any type of file fine, get/display headers fine, etc. With Mozilla, using the same HTML/JS it always returns no data (xmlhttp.responseText is null). When I try to get headers using Mozilla or display the http status code I get some obscure exception in the javascript console that I've given up on searching for an...
6
2580
by: Wescotte | last post by:
I've wrote a little test app to use XMLHTTPRquest test app but I'm looking to add some functionality and I'm not quite so how to go about doing it. Below is the source What I'd really like is to be able to use <SPAN onClick = "Select(this);"> where I could pass the object and not have to display the results of
7
2613
by: pbd22 | last post by:
Hi. I am somewhat new to this and would like some advice. I want to search my xml file using "keyword" search and return results based on "proximity matching" - in other words, since the search string will often not produce a direct match, the results will be based on proximity (50%, 20% 100%, etc). are there any good examples out there on how to do keyword searches on XML data? How should i set up my xml file so
3
3460
by: SM | last post by:
Hello, Im trying to access elements in my XML file using the JavaScript DOM but i'm not sure how. I use AJAX to access the XML and then use the responseXML property to access the XML file data. I want to extract all the tracks from a specific CD. Right now, im using an array to stock all the data but its just a question of time before everything blows up because of the size of the array. Thats why im want to use an XML file (later i will...
10
14150
by: neverquit | last post by:
hi , Iam Nagesh,Begineer in using Ajax,well i have been using ajax in application, i have faced a problem while placing the responseTEXT into the <div> tag positioned inside the <form> tag iam able to get the response in the <div> tag in mozilla (im takingthe HTML response), <script> function confirm() { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null)
2
5343
by: mukeshrasm | last post by:
hello i want to display the subjects on the same page based on class selected by user. i am using dropdown for classes. so when user will select a particular class then it will display subjects in the same page based on class from database. i am giving my code along with so please tell me the error. code for database <?php include "database.php";
20
9084
by: vjayis | last post by:
hi when i m trying to fetch data from one page to another page using ajax, i get an error message in IE., but it runs well in firefox., could anyone help me., here is my javascript code., <script type="text/javascript"> var id; var action; function httprequest(id,action) {
5
1918
by: perhapscwk | last post by:
I want to use ajax, by selected the option box, retrieve data from a .xml file and fill in to the textbox. below is the html page <script src="selectcd.js"></script> <form> Select a CD: <select name="cds" onchange="showCD(this.value)">
6
4665
by: tinman486 | last post by:
Im new to the whole javascript game, I know pretty much just enough to be dangerous with no real substance. Anyway Im trying to populate a DIV with a website using the URL as an inner html source Here is my code I keep getting an error object expecte don line 58. Which I will highlight. Anyway Not only would i Like to know what that error is about but also if my logic is correct or if I can even do what im trying... and if not what other...
5
4456
by: thatcollegeguy | last post by:
Below are my 3php and 2js files. I create a table using ajax/php and then want to change the values in the tables add(+ number for teamid) id's for each specific td in the table. I don't know if I have the entirely wrong approach, but my code is below. Any or all help is appreciated! What currently happens is that the getdivision.php script works perfectly and gives me an entire table of correct data. The problem is that when I click...
0
8380
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8296
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8710
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8598
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.