File upload only with clearsilver C API

"maxsimon1980" <[email protected]> Wed, 20 Aug 2008 05:01:15 -0000
Newsgroups gmane.text.clearsilver.general
Message-ID <[email protected]>
hello sir,

i have created a html file with following tags,


<form method="post" enctype="multipart/form-data" action="upload.cgi">  
	<tr class="ch_fl1">
		<td class="input">
			<input type="file" id="file1" name ="file">
			<input name="filebtn" type="submit" value='submit'> 
		</td>
	</tr>
</form>




and in my upload.cgi file i have written as,


int main (int argc, char **argv, char **envp)
{

	NEOERR *err;
	CGI *cgi;
	char *cs_file;
	char hdf_file[255];
	char *p;
	FILE *fp,*k;

	cgi_debug_init (argc,argv);
	cgiwrap_init_std (argc, argv, envp);

	err = cgi_init(&cgi, NULL);
	if (err != STATUS_OK)
	{
	cgi_neo_error(cgi, err);
	nerr_log_error(err);
	return -1;
	}


	err=hdf_set_value(cgi->hdf,"Config.Upload.TmpDir","var/tmp");
		
	err = hdf_set_value(cgi->hdf, "Config.Upload.Unlink", "0");

	err = parse_rfc2388 (cgi);
	if (err != STATUS_OK)
	{
	cgi_neo_error(cgi, err);
	nerr_log_error(err);
	return -1;
	}

	err = hdf_write_file(cgi->hdf, "myhdffile.hdf");

	err = cgi_display (cgi, "update.cs");
	if (err != STATUS_OK)
	{
	cgi_neo_error(cgi, err);
	nerr_log_error(err);
	return -1;
	}
	return 0;
}

*********************************************************

when i write like this in my cgi file and i tried to upload it my the
localhost with Apache as my http server i got error in the apache log
file as,

[Tue Aug 12 16:28:20 2008] [error] [client 127.0.0.1] Traceback
(innermost last):\r, referer: http://localhost/cgi-bin/update.cgi
[Tue Aug 12 16:28:20 2008] [error] [client 127.0.0.1]   File
"rfc2388.c", line 581, in parse_rfc2388()\r, referer:
http://localhost/cgi-bin/update.cgi
[Tue Aug 12 16:28:20 2008] [error] [client 127.0.0.1]   File
"rfc2388.c", line 548, in _read_part()\r, referer:
http://localhost/cgi-bin/update.cgi
[Tue Aug 12 16:28:20 2008] [error] [client 127.0.0.1]   File
"rfc2388.c", line 311, in open_upload()\r, referer:
http://localhost/cgi-bin/update.cgi
[Tue Aug 12 16:28:20 2008] [error] [client 127.0.0.1] SystemError:
Unable to open temp file var/tmp/cgi_upload.a03784: [2] No such file
or directory\r, referer: http://localhost/cgi-bin/update.cgi


I don't know whether i have made any error in writing my code .if
there is any error please guide  me.


if you have any solution please kindly reply to me.
Thanks and regards in advance.