![]() |
Cgi File Upload without Form
Hello,
what is the simplest way to upload a file (or a long string) to a server using cgi/python? Since I want to upload the data programmatically, a form based solution is not good. I am not experienced with SOAP/WSDL and I believe that would be more difficult than necessary. The client program I have to use does not support FTP. Any hint appreciated, kind regards, Karsten. |
Re: Cgi File Upload without Form
En Fri, 27 Apr 2007 18:10:42 -0300, <Karsten.G.Weinert@googlemail.com>
escribió: > what is the simplest way to upload a file (or a long string) to a > server using cgi/python? > > Since I want to upload the data programmatically, a form based > solution is not good. I am not experienced with SOAP/WSDL and I > believe that would be more difficult than necessary. The client > program I have to use does not support FTP. I don't understand your question. Do you control the server, the client, or both? Which one is in Python? -- Gabriel Genellina |
Re: Cgi File Upload without Form
Karsten.G.Weinert@googlemail.com skrev:
> Hello, > > what is the simplest way to upload a file (or a long string) to a > server using cgi/python? > > Since I want to upload the data programmatically, a form based > solution is not good. I am not experienced with SOAP/WSDL and I > believe that would be more difficult than necessary. The client > program I have to use does not support FTP. Try out urllib2 -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science |
Re: Cgi File Upload without Form
Karsten.G.Weinert@googlemail.com wrote:
> Hello, > > what is the simplest way to upload a file (or a long string) to a > server using cgi/python? > > Since I want to upload the data programmatically, a form based > solution is not good. I am not experienced with SOAP/WSDL and I > believe that would be more difficult than necessary. The client > program I have to use does not support FTP. > A "form-based" solution is actually just what you want - you write a Python program that does just what the user's browser would do after they filled in a form. You can do this with urllib fairly easily. If you get stuck then look for a library called mechanise. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden ------------------ Asciimercial --------------------- Get Python in your .sig and on the web. Blog and lens holdenweb.blogspot.com squidoo.com/pythonology tag items: del.icio.us/steve.holden/python All these services currently offer free registration! -------------- Thank You for Reading ---------------- |
Re: Cgi File Upload without Form
Karsten.G.Weinert@googlemail.com wrote:
> Hello, > > what is the simplest way to upload a file (or a long string) to a > server using cgi/python? > > Since I want to upload the data programmatically, a form based > solution is not good. I am not experienced with SOAP/WSDL and I > believe that would be more difficult than necessary. The client > program I have to use does not support FTP. > A "form-based" solution is actually just what you want - you write a Python program that does just what the user's browser would do after they filled in a form. You can do this with urllib fairly easily. If you get stuck then look for a library called mechanise. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden ------------------ Asciimercial --------------------- Get Python in your .sig and on the web. Blog and lens holdenweb.blogspot.com squidoo.com/pythonology tag items: del.icio.us/steve.holden/python All these services currently offer free registration! -------------- Thank You for Reading ---------------- |
Re: Cgi File Upload without Form
Thanks for your replies, however I think urlllib can not help me here.
I have control over the server side (I can write a cgi-script in python), but I have very little control on the client side (I have to use VBA). Kind regards, Karsten. |
Re: Cgi File Upload without Form
> Since I want to upload the data programmatically, a form based
> solution is not good. Karsten, Could you explain this statement? When I want to move data to a server in a CGI environment, a form post is the easiest way I can think of. What are the specific restrictions making forms a problem? -Dave |
Re: Cgi File Upload without Form
On 30 Apr., 15:51, "Dave Borne" <dbo...@gmail.com> wrote:
> > Since I want to upload the data programmatically, a form based > > solution is not good. > > Karsten, > Could you explain this statement? When I want to move data to a > server in a CGI environment, a form post is the easiest way I can > think of. What are the specific restrictions making forms a problem? > > -Dave Hello Dave, what I was thinking was: a form post is meant to be used manually. But maybe I am wrong here and I can teach my VBA program to fill in forms automatically. If I were using python as client, I could fill in forms with urllib. However, I using python only server-side. Kind regards, Karsten. |
Re: Cgi File Upload without Form
OK, I think I have a simple solution now. I am going to use FTP in my
VBA-Client (it's possible) and don't need to do any server-side programming. Kind regards, Karsten. |
Re: Cgi File Upload without Form
Karsten.G.Weinert@googlemail.com napisa³(a):
>> Could you explain this statement? When I want to move data to a >> server in a CGI environment, a form post is the easiest way I can >> think of. What are the specific restrictions making forms a problem? > what I was thinking was: a form post is meant to be used manually. But > maybe I am wrong here and I can teach my VBA program to fill in forms > automatically. If I were using python as client, I could fill in forms > with urllib. However, I using python only server-side. "Form" usually means an action accessible for HTTP POST request with content-type multipart/form-data. Uploading files is usually done in this way, if you don't want/cann't use more sophisticated means like WebDAV (which is HTTP extension, btw). -- Jarek Zgoda http://jpa.berlios.de/ |
| All times are GMT. The time now is 09:39 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.