peter_van_dam — 2007-04-28T04:56:33-04:00 — #1
Can anyone show me some example code of uploading a file using a web service?
For the moment it is a text file.
mihd — 2007-04-28T06:21:02-04:00 — #2
amazon s3 do this i believe
peter_van_dam — 2007-04-28T06:29:22-04:00 — #3
Thank you for your replay, I had a look at it. They are submitting the form as following:
Now I know that this works but the point is that I basically don't have a web server, just web services. So instead of submitting a form I read the data, wrap it into a soap message and issue a web service call. I can add web services at will but I want to avoid having to program on the web server (the web service communicates with an application server).
So I guess what I need to do is to find out how to read the CONTENTS of the file into a variable so I can submit the data to the web service.
mihd — 2007-04-28T06:35:24-04:00 — #4
hi firstly that the form on my site you looked at, lol
amazon s3 webservice is here http://www.amazon.com/S3-AWS-home-page-Money/b?ie=UTF8&node=16427261
i havent looked into it myself yet, as we use secure ftp to transfer files in background, i imagine the overhead for a webservice would be massive
but i presume the binarry data could be base64 encoded (or something similar) into the SOAP responce?
mihd — 2007-04-28T06:38:16-04:00 — #5
anyways i found thse, could be usefull, u got me interested now
simplyfu — 2007-04-28T07:19:27-04:00 — #6
I guess he was trying to ask whether he can use Ajax to upload file to other web service provided by a site from different domain
peter_van_dam — 2007-04-28T07:37:05-04:00 — #7
Surely I am working on an Ajax application and I communicate with my own application server thru web services. So I am in control of both sides.
First let met tackle a simple text file (which is the case at hand now) and later I suppose I will want to add base64 encoding for binary files.
peter_van_dam — 2007-04-28T15:12:19-04:00 — #8
I tried the following which is exactly what I want, but unfortunately I get access denied in both IE and Firefox:
var myRequest = new XMLHttpRequest;
var myText = myRequest.responseText;
simplyfu — 2007-04-28T16:24:34-04:00 — #9
you cannot get local file with "file:" protocol. It violates the rule to protect users' security
peter_van_dam — 2007-04-28T17:24:46-04:00 — #10
So back to the drawing board. Any takers?
voodoomagic — 2007-04-28T18:10:40-04:00 — #11
peter_van_dam — 2007-04-29T04:51:53-04:00 — #12
OK I understand that and it makes sense (although the form method has access to local files as well but that aside).
mihd — 2007-04-29T05:35:34-04:00 — #13
well if you going to go to the whole bother of uplaoding to the server why dont you let the server send the file as a webservice then? instead of sending it back
mihd — 2007-04-29T15:13:27-04:00 — #14
simplyfu — 2007-04-29T23:25:23-04:00 — #15
Well, it depends what it does first
peter_van_dam — 2007-05-02T03:29:13-04:00 — #16
Well it seems I cannot stay away from PHP on the web server to solve the upload problem.
I am going to look into uploading the file to a PHP program on the server that copies it to my target server directory for subsequent processing by my normal application server through a web service command.
Thanks for the help.