Cgi File Upload without Form

K

Karsten.G.Weinert

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.
 
G

Gabriel Genellina

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?
 
M

Max M

(e-mail address removed) 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
 
S

Steve Holden

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 ----------------
 
S

Steve Holden

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 ----------------
 
K

Karsten.G.Weinert

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.
 
D

Dave Borne

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
 
K

Karsten.G.Weinert

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.
 
K

Karsten.G.Weinert

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.
 
J

Jarek Zgoda

(e-mail address removed) napisa³(a):
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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top