PlanetJava
Custom Search

java-grinder-user
[Top] [All Lists]

Re: multipart form submission.......

Subject: Re: multipart form submission.......
Date: Mon, 15 Dec 2008 15:03:28 +0200
Hi, Phil,
          Thanks for the response.  Will be more than happy to jump through the 
hoops, once I have fixed the double upload issue.
  Response to your points.
>>You probably also want to change
>>
>>     files = ( NVPair('self', 'document/'+filename1+''), )
>>
>>to
>>
>>     files = ( NVPair('body:form:documentFile', 'document/'+filename1+''), )
Tried this in my code and the upload "breaks".  But, this is a minor point for 
now(I will change this line later in the email), I concentrated on your other 
suggestion below:-
>>You are specifying the file data twice, once in the files variable and >>once 
>>in the parameters variable. I think you should remove
>>     NVPair('body:form:documentFile\"; 
>> >>filename=\"'+filename1+'',''+zipfile+''),
>>from the parameters. (Which then means you don't need to explicitly read
>>the file into zipfile; Codecs.mpFormDataEncode does that for you).
Yes, I agree that I am specifying it twice.  You suggest a different approach 
to the one I had.  This makes logical sense to me, and whilst I agree with the 
logic, in practise this does not bear fruit.  Essentially, this removes the 
parameter "filename" from the headers. Which my script seems to require, and it 
fails.
Ie in proxy capture this line is missing...
-----------------------------137357244014788080171010743019
Content-Disposition: form-data; name="body:form:documentFilename"
scott.zip
What I did do instead, was to remove the "b" from the following line
file1 = open("document/"+filename1+"", 'rb')
Ie, make the file text.  The upload now fails, but add it back in and it works. 
 So this "indicates" that the actual file being uploaded is the one specified 
by the line
NVPair('body:form:documentFile\"; filename=\"'+filename1+'',''+zipfile+''),
So I seem to need this line, which is not where I want to be.....
Next I tried tried specifying the files variable as...
     files= None
This seems to work, and I only have one upload in the file.  However, the
" Content-Type: application/octet-stream"
Appears to be missing from the proxy capture.  But it does seem to work.
I get the feeling, I am very close, but there is something very obvious that I 
am missing/assuming/don't know.....
                                Any further help appreciated
                                                Sc0tt...
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
msgmiddle
<Prev in Thread] Current Thread [Next in Thread>
Current Sitemap | © 2012 planetjava | Contact | Privacy Policy