By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,996 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,996 IT Pros & Developers. It's quick & easy.

Cgi File Upload without Form

P: n/a
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.

Apr 27 '07 #1
Share this Question
Share on Google+
9 Replies


P: n/a
En Fri, 27 Apr 2007 18:10:42 -0300, <Ka***************@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
Apr 28 '07 #2

P: n/a
Ka***************@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
Apr 28 '07 #3

P: n/a
Ka***************@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 ----------------
Apr 28 '07 #4

P: n/a
Ka***************@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 ----------------

Apr 28 '07 #5

P: n/a
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.

Apr 30 '07 #6

P: n/a
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
Apr 30 '07 #7

P: n/a
On 30 Apr., 15:51, "Dave Borne" <dbo...@gmail.comwrote:
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.

Apr 30 '07 #8

P: n/a
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.

Apr 30 '07 #9

P: n/a
Ka***************@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/
Apr 30 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.