Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3497824
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:25:03+00:00 2026-05-18T12:25:03+00:00

I need to Post Forms and Upload Files to a website using Linux Command

  • 0

I need to Post Forms and Upload Files to a website using Linux Command Line.

I have done some search, and I would like to write the script in Python.

I need to first log in the website, save the cookies and then post form data and upload files to that website.

Here is the details:

The website’s log in page is:hxxp://www.example.com/login.html

<form action="/signin.html" method="post"> 
Username:<input type="text" name="username">
Password:<input type="password" name="password">
<input type="hidden" name="referer" value="http://www.example.com/"> 
<input type="submit" name="submit" value="  Login  ">
</form>

The upload page is:hxxp://www.example.com.com/upload/

<form action="http://www.example.com:81/upload/upload.cgi" enctype="multipart/form-data" method="post"> 
<input type="hidden" name="MAX_FILE_SIZE" value="314572800" /> 

File:
<input name="filename[]" type="file" />
Type:
<input type="radio" name="typeID" value=1> Option One
<input type="radio" name="typeID" value=2> Option Two
<input type="radio" name="typeID" value=3> Option Three
Title:
<input type="text" name="title" > 
Description:
<textarea name="description"></textarea>

<input type="checkbox" name="agree" value="agree_terms"> I Accept Terms

<input type="submit" value="Upload It!">
</form>

This form contains radio, text, checkbox, file etc input.

Please give me some hint!

I am using CentOS 5.5, with Python, wget, PHP installed. I think this can be done in Python script.

Thanks a lot! Your answer will be the best Christmas gift I have received. 😉

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:25:04+00:00Added an answer on May 18, 2026 at 12:25 pm

    You could of course use urllib2 to accomplish this task. Read the docs on how to deal with cookies and how to upload files. However, I think using mechanize could save a lot of time. Mechanize allows you to deal with webpages as if you were using a browser:

    import mechanize
    
    br = mechanize.Browser()
    br.open("http://www.example.com/")
    br.select_form()
    br['username'] = 'user'
    br['password'] = 'pass'
    br.submit()
    
    etc.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a classifieds website, where anyone (no need for login currently) can post
I have an action which I need to post forward onto another action if
I am working on a ASP.NET app and i have a need to post
I need to capture the HTML and do some post processing on the HTML
I have a similar problem to this post . I need to display up
I'm trying to upload a picture to a specific website using php cURL but
I am using the Uploadify Plugin to Upload files. although this might be a
I have developed a download/upload manager script. When I upload a file via POST
i have a input tag which is non editable, but some times i need
in order to monitor the upload of large video files I'm using the progress

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.