cURL / Mailing Lists / curl-users / Single Mail

curl-users

Curl and Multiple File Downloads, again

From: Huntress Gary B NPRI <HuntressGB_at_npt.nuwc.navy.mil>
Date: Wed, 26 Oct 2005 09:21:09 -0400

This is a followup to my question from yesterday titled "Mulitpart Forms and File Downloads".

The form consists of many rows. Each row corresponds to a file. If a checkbox is selected the file can be downloaded. Otherwise a file can be uploaded. The form is declared as:

<form target=_parent action=https://www.foo.bar/pdmnet-bin/cgfiles.sh method=post enctype="MULTIPART/FORM-DATA">

If I use my browser to select 2 files for download, and post the form, this is the response I get:

----SWEBOUNDARY
Set-Cookie: myLockSetCookie=2220031-5-MK14_20004_5021_R2.CSV; path=/;
----SWEBOUNDARY
Content-type: application/CSV
Content-Disposition: attachment; filename="2220031-5-MK14_20004_5021_R2.CSV"
.....
DATA
DATA
DATA
......
----SWEBOUNDARY
Set-Cookie: myLockSetCookie=2220031-5MK14_20004_5021D1R1.CSV; path=/;
----SWEBOUNDARY
Content-type: application/CSV
Content-Disposition: attachment; filename="2220031-5MK14_20004_5021D1R1.CSV"
........
DATA
DATA
DATA
.......
----SWEBOUNDARY
Set-Cookie: myLockSetCookie=RESET; path=/;
----SWEBOUNDARY--
Content-type: text/html

<html><head><title></title></head>
<body bgcolor=white>
All files successfully downloaded
</body></html>

I saved the querystring from a successful post and submitted that using -d and -F but I get an application error saying I have not selected a file to download. Since I'm fairly sure that my querystring is ok then I'm guessing it's a header/cookie issue. Here is my curl in its entirety:

curl -c cookiejar -b cookiejar -F "SEXPORT=Copyout&TOOL_NAME=GENERIC_UNIX&RECTYPE=DOCUMENT&RECNAME=TTPR-01.10.04-RR45096%7E15090&RECALT=C&RECVER=110&LASTFILENAME=2220050-6MK14_20134_5212.CSV&XOPAL=XOPAL&STAGROW=EXISTINGFILE&UNIXALIAS=2220031-5-MK14_20004_5021_R2.CSV&ALIAS=2220031-5-MK14_20004_5021_R2.CSV&SFILEDESC=5021%2C+R2%2C+8-9-05&START_TOOL=Y&SFILEUPLOAD=&UNIXALIAS=2220031-5MK14_20004_5021D1R1.CSV&ALIAS=2220031-5MK14_20004_5021D1R1.CSV&SFILEDESC=5021%2C+D1R1%2C+8-9-05&START_TOOL=Y&SFILEUPLOAD=&UNIXALIAS=2220051-7_20043_5193.CSV&ALIAS=2220051-7_20043_5193.CSV&SFILEDESC=5193%2C+8%2F2%2F05&START_TOOL=Y&SFILEUPLOAD=" "https://www.foo.bar/pdmnet-bin/cgfiles.sh"

I have no problems using curl with any other page on this site (login, search, view, etc). I'm unclear what the target=_parent indicates in the form tag, this page has no frames. I'm not sure if that is the cause of my problem. If anyone has any suggestions, I'd like to hear them.

Even though I have not reached the point where I get a successful response, I'm wondering if/how curl can handle the multiple Content-disposition: attachment; portions of the response. Will curl be able to save the individual files from the response?

Regards,

Gary Huntress
Code 4113
Naval Undersea Warfare Center
Newport, RI 02841
1-800-669-6892 x28990
Received on 2005-10-26