473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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.

Apr 27 '07 #1
9 2304
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tim218 | last post by:
Hi Everyone This is my first day with PHP and, not surprisingly, I've run into a problem :-) I want to allow file uploads to the server without exposing the non-technical end-users to FTP...
20
by: CHIN | last post by:
Hi all.. here s my problem ( maybe some of you saw me on other groups, but i cant find the solution !! ) I have to upload a file to an external site, so, i made a .vbs file , that logins to...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
2
by: mark | last post by:
How do I detect that a particular form element is a file upload or if the file upload has worked? In the Python cgi module documentation I found suggested code... form = cgi.FieldStorage()...
1
by: gryffin | last post by:
im trying to do file extension checking but its not working :( i have the following in the head <script language="JavaScript"> extArray = new Array(".jpg", ".png", ".bmp"); function...
7
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file"...
4
by: google.com | last post by:
Hi there! I've been digging around looking for a sample on how to upload a file without user action. I found the following article covering the area: ...
3
by: shapper | last post by:
Hello, I need to upload a file. Can I only do this with the File Upload control? I also need the following: - Send upload info, upload percentage, continuously to a JavaScript function so...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
1
by: ririe | last post by:
Hi. I have a problem here. I want to upload a file together with its semester. So I create two field. One for the semester and one for the file to be uploaded. But the script doesn't work. I don't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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...
0
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...
0
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,...

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.