[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wget
Subject:    Re: How to do a file upload
From:       Jim Cox <mcbsoftware () yahoo ! com>
Date:       2005-04-25 19:55:02
Message-ID: 20050425195502.19334.qmail () web50003 ! mail ! yahoo ! com
[Download RAW message or body]

--- John <jmw15@yahoo.com> wrote:
> > 
> > Hello,
> > 
> > I have a relatively simple process of uploading a
> file that I am trying
> > to
> > perform with wget but I am having problems with
> the syntax.  Can someone
> > please help?  Thank you in advance.
> > 
> > I am trying to replicate the process of uploading
> a file that is common
> > to
> > a lot of webpages.  The webpage has a INPUT
> TYPE="file" dialog and also
> > a
> > button to sumbit the document.
> > 
> > I am just trying to upload a very simple csv file.
>  It only has 2
> > columns
> > and 2 rows and is shown below:
> > 
> > Order,Number
> > 2245,3
> > 2246,7
> > 
> > The page I am trying to interface with has a
> button that says "import
> > order items info" and a field next to it where you
> enter the file path. 
> > Here is the HTML of the page that I am trying to
> interface with:
> > 
> > <form enctype="multipart/form-data"
> > action="URL_GOES_HERE/po_management.php"
> method="POST">
> > <TR><td colspan=6>&nbsp;</td></TR>
> > <TR>
> > 	<TD colspan="4" align="left" valign="bottom">
> > 		<B>Order Import CSV:</B>
> > 		<input type="hidden" name="MAX_FILE_SIZE"
> value="3000000" />
> > 		<INPUT TYPE="file" NAME="import_file"/>
> > 	</TD>
> > 	<TD colspan="2" align="left" valign="bottom">
> > 		<INPUT TYPE="SUBMIT" VALUE="import order items
> info"
> > NAME="import_items"
> > class="button" />
> > 	</TD>
> > 
> > This is what I think my wget command should be:
> > wget --post-file=upload.txt
> --output-document=output.txt
> > URL_GOES_HERE/po_management.php
> > 
> > Where upload.txt is:
> > &import_items=import order items
> info&import_file=Order, Number
> > 2245,3
> > 2246,7
> > 
> > If someone could please help me with what I am
> doing wrong and what I
> > should change I would appreciate it.  Thank you.

From the "enctype" of the INPUT tag you supplied it
looks like you have to POST with "multipart/form-data"
as in RFC 1867
(http://www.faqs.org/rfcs/rfc1867.html). Look in
section 6 of that doc for examples.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic