For Programmers: Free Programming Magazines  


Home > Archive > Tcl > October 2006 > I need your help about a web upload file problem.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author I need your help about a web upload file problem.
Harry

2006-10-23, 8:02 am

Here I used TclCurl to implement "upload a file through web to upgrade
the target instrument", But when I used the httppost, I got the "method
not allowed".
Here is HTML page's source:
<tr>
<td>
<FORM METHOD="POST" ENCTYPE="multipart/form-data"
ACTION="/webconfig/upgrade_image/image_upgrade.html/upgrade_image">
<table class="data_main">

<tr>
<td colspan="3">
<table class="data_table">
<tr>
<td class="space" width="20"> </td>
<td class="dotted_line" colspan=""></td>
<td class="space" width="20"> </td>
</tr>

<tr>
<td class="space" width="20"> </td>
<td class="data_table_head">New Firmware File
Name:</td>
<td class="space" width="20"> </td>
</tr>
<tr>
<td class="space" width="20"> </td>
<td class="data_table_data"><INPUT type="file"
NAME=".filename_handle" SIZE="56" VALUE=""></td>
<td class="space" width="20"> </td>
</tr>
<tr>
<td class="space" width="20"> </td>
<td class="red_comm"><b>Warning: DO NOT switch off your
during firmware upgrades.</b></td>
<td class="space" width="20"> </td>
</tr>
<tr>
<td class="space" width="20"> </td>
<td class="dotted_line" colspan=""></td>
<td class="space" width="20"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="space" width="6"> </td>
<td class="grey_comm">
The status of the upgrade will be displayed. Please wait
for the upgrade to complete before continuing to navigate the
configuration manager.
</td>
<td class="button" align="right"><INPUT type="hidden"
name="url" VALUE=""><INPUT type="submit" name="Update"
onClick="call_alert()" ; VALUE="Upgrade"></td>
<td width="10"></td>
</tr>
</table>

</FORM>
</td>
</tr>

Here is my TCL source:
set curlHandle [curl::init]
$curlHandle configure -userpwd admin:admin -url $url -file local2.html
$curlHandle configure -httppost [list name ".filename_handle" file
$tarFile contenttype "application/x-tar"]

$curlHandle perform

But I opened the local2.html to check the status, I got the "method not
allowed"
Could anybody help me?

fandom@telefonica.net

2006-10-23, 7:03 pm

Hi,

You could try:

set curlHandle [curl::init]
$curlHandle configure -userpwd admin:admin -url $url -file local2.html
$curlHandle configure
\
-httppost [list name ".filename_handle" file $tarFile contenttype
"application/x-tar"] \
-httppost [list name url value ""] \
-httppost [list name "Update" value "Upgrade"] -verbose 1
[...]

For the url, are you using


www.site.com/webconfig/upgrade_imag...l/upgrade_image
?

Andres

Harry

2006-10-23, 10:03 pm

Hi, Andres:
I am using the url
www.site.com/webconfig/upgrade_image/image_upgrade.html to upload a
tar file, if I submit the file successfully, the page will turn to
www.site.com/webconfig/upgrade_imag.../upgrade_image,
I did as you mentioned, but get another "method not allowed",
Andres:
Could you give me several successful examples ? that can help
me much.
Tks.

fandom@telefonica.net wrote:
> Hi,
>
> You could try:
>
> set curlHandle [curl::init]
> $curlHandle configure -userpwd admin:admin -url $url -file local2.html
> $curlHandle configure
> \
> -httppost [list name ".filename_handle" file $tarFile contenttype
> "application/x-tar"] \
> -httppost [list name url value ""] \
> -httppost [list name "Update" value "Upgrade"] -verbose 1
> [...]
>
> For the url, are you using
>
>
> www.site.com/webconfig/upgrade_imag...l/upgrade_image
> ?
>
> Andres


fandom@telefonica.net

2006-10-24, 8:03 am

> I am using the url
> www.site.com/webconfig/upgrade_image/image_upgrade.html to upload a
> tar file, if I submit the file successfully, the page will turn to
> www.site.com/webconfig/upgrade_imag.../upgrade_image,


In the curl::configure comand you have to use the second url, since it
is the
one in the 'ACTION' field.


> Could you give me several successful examples ? that can help
> me much.



I am afraid not, since I am not at home this w, so I can onlypoint
you
at the example in the 'tests' directory.

One thing you can try is to save the html page with the form at your
hard disk and
change the method from POST to GET, load the page in your browser and
submit,
in the url shown by your browser should indicate all the fields with
the values you
should be using.

Andres

Harry

2006-10-30, 7:32 pm

Is there any way to submit a button?
Could you kindly give me a sample of submit a button in a html page?

and dude, could you tell me where I can find some examples?

fandom@telefonica.net wrote:
>
> In the curl::configure comand you have to use the second url, since it
> is the
> one in the 'ACTION' field.
>
>
>
>
> I am afraid not, since I am not at home this w, so I can onlypoint
> you
> at the example in the 'tests' directory.
>
> One thing you can try is to save the html page with the form at your
> hard disk and
> change the method from POST to GET, load the page in your browser and
> submit,
> in the url shown by your browser should indicate all the fields with
> the values you
> should be using.
>
> Andres


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com