Loading ...
Sorry, an error occurred while loading the content.

File upload only with clearsilver C API

Expand Messages
  • maxsimon1980
    hello sir, i have created a html file with following tags,
    Message 1 of 2 , Aug 19, 2008
    View Source
    • 0 Attachment
      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.
    • Gerald Dachs
      ... try err=hdf_set_value(cgi- hdf, Config.Upload.TmpDir , /var/tmp ); Gerald ... This message was sent using IMP, the Internet Messaging Program.
      Message 2 of 2 , Aug 20, 2008
      View Source
      • 0 Attachment
        > err=hdf_set_value(cgi->hdf,"Config.Upload.TmpDir","var/tmp");

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

        Gerald

        ----------------------------------------------------------------
        This message was sent using IMP, the Internet Messaging Program.
      Your message has been successfully submitted and would be delivered to recipients shortly.