[Http-webtest-general] Re: uploading a file
Brought to you by:
m_ilya,
richardanderson
From: Ilya M. <il...@ma...> - 2003-01-31 22:59:16
|
>>>>> On Fri, 31 Jan 2003 16:27:53 -0500 (EST), Jagannadh Pariti <jagpariti= @yahoo.ca> said: JP> Hi. I was trying to test uploading a file, but the server that handles = the JP> request complains that the file does not exist. JP> [..snip..] JP> params =3D ( JP> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 name =3D> John JP> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0upload =3D> (file= =3D> /home/john/file_name.txt JP> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Content-Type =3D> 'multipart/form-data' ) JP> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0) Syntax of params block is wrong here. It probably should look like: params =3D ( name =3D> John upload =3D> ( /home/john/file_name.txt ) ) or params =3D ( name =3D> John upload =3D> ( /home/john/file_name.txt=20 file_name.txt ) ) or params =3D ( name =3D> John upload =3D> ( /home/john/file_name.txt=20 file_name.txt Content-Type =3D> text/plain ) ) Some background: When you do file uploads content of form is encoded as multipart MIME data streams (see RFC1867 for explanation) and each parameter is represented as a separate MIME part which can have its own headers. Syntax Explanation: When you specify file upload parameter it is specified as a list which looks like ( FILE, FILENAME, HEADER =3D> VALUE... ) where FILE - is path to file which is sent to the server (optional) FILENAME - filename which appear in the headers of corresponding MIME part (optional) HEADER =3D> VALUE, ... - These parameters let you to specify additional headers for corresponding MIME part. For example they can be used to specify a type of the uploaded file. I.e. text/plain for plain text or image/png for PNG images. --=20 Ilya Martynov, il...@ip... CTO IPonWEB (UK) Ltd Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net Personal website - http://martynov.org |