⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ebmultiform.html

📁 eybuild中文手册 eybuild中文手册 eybuild中文手册
💻 HTML
字号:
<html>
<head>
<!-- E:/eybuild/doc/export//ebmultiform.html - generated by refgen from ebmultiform.c -->
 <title> ebmultiform </title>
</head>
<body bgcolor="#FFFFFF"> <hr>

<a name="top"></a>
<p align=right>
<a href="libIndex.htm"><i>eyBuildLib API Reference :  eyBuildLib</i></a></p>

</blockquote><h1>ebmultiform</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  
<p><strong>ebmultiform</strong> - process http multipart/form-data method </p>


</blockquote><h4>ROUTINES</h4><blockquote><p>
<p>
<b><a href="./ebmultiform.html#addPostItem">addPostItem</a>(&nbsp;)</b>  -  insert item name and limit the max size of value <br>
<b><a href="./ebmultiform.html#getPostItemValue">getPostItemValue</a>(&nbsp;)</b>  -  get post item value by item name<br>
<b><a href="./ebmultiform.html#getPostFileCount">getPostFileCount</a>(&nbsp;)</b>  -  get the number of files uploaded<br>
<b><a href="./ebmultiform.html#getPostSrcFileName">getPostSrcFileName</a>(&nbsp;)</b>  -  get source file name by index from post<br>
<b><a href="./ebmultiform.html#movePostFile">movePostFile</a>(&nbsp;)</b>  -  move post file by index to specified directory<br>
<b><a href="./ebmultiform.html#createPostParam">createPostParam</a>(&nbsp;)</b>  -  create a struct to hold post parameters<br>
<b><a href="./ebmultiform.html#distoryPostParam">distoryPostParam</a>(&nbsp;)</b>  -  free post parameters<br>
<b><a href="./ebmultiform.html#installPostHook">installPostHook</a>(&nbsp;)</b>  -  install hooks and cookie to this post<br>
<b><a href="./ebmultiform.html#dopost">dopost</a>(&nbsp;)</b>  -  read post data and parse it<br>
<b><a href="./ebmultiform.html#distoryPost">distoryPost</a>(&nbsp;)</b>  -  free this post<br>
<p>
</blockquote><h4>DESCRIPTION</h4><blockquote><p>
This module read post data (<b>multipart/form-data</b> only) and parse each 
part and store into file-list and item-list. Later user can get each part
in post by call <b><a href="./ebmultiform.html#getPostItemValue">getPostItemValue</a>(&nbsp;)</b>, <b><a href="./ebmultiform.html#getPostSrcFileName">getPostSrcFileName</a>(&nbsp;)</b>, <b><a href="./ebmultiform.html#getPostFileCount">getPostFileCount</a>(&nbsp;)</b>, 
<b><a href="./ebmultiform.html#movePostFile">movePostFile</a>(&nbsp;)</b> and so on.
<p>
User can limit this post actions by call <b><a href="./ebmultiform.html#createPostParam">createPostParam</a>(&nbsp;)</b>, <b>setPostItem(&nbsp;)</b>.
<b>setPostItem(&nbsp;)</b> is to insert an post item and limit the max size of items value.
If you don't call it in advance, <b><a href="./ebmultiform.html#dopost">dopost</a>(&nbsp;)</b> will call it and set to default
size (256Bytes).
<p>
At last user should free those list by call <b><a href="./ebmultiform.html#distoryPostParam">distoryPostParam</a>(&nbsp;)</b> or 
<b><a href="./ebmultiform.html#distoryPost">distoryPost</a>(&nbsp;)</b>. Note, you should not call <b><a href="./ebmultiform.html#distoryPostParam">distoryPostParam</a>(&nbsp;)</b> after call 
<b><a href="./ebmultiform.html#distoryPost">distoryPost</a>(&nbsp;)</b>.
<p>
</blockquote><h4>INCLUDE</h4><blockquote><p>
<b>ebmultiform.h</b>
<p>
</blockquote><h4>SEE ALSO</h4><blockquote><p>
<b>ebpost.h</b>, <b>itemlist.h</b>

<hr>
<a name="addPostItem"></a>
<p align=right>
<a href="rtnIndex.htm"><i>eyBuildLib :  Routines</i></a></p>

</blockquote><h1>addPostItem(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  
<p><strong>addPostItem(&nbsp;)</strong> - insert item name and limit the max size of value </p>

</blockquote><h4>SYNOPSIS</h4><blockquote><p>
<pre>int addPostItem
    (
    POST_PARAM * p_param,     /* where set to */
    char *       name,        /* item name */
    int          max_size     /* max size of value may be returned */
    )
</pre>

</blockquote><h4>DESCRIPTION</h4><blockquote><p>
this routine is to insert an item before post done it, we can limit 
the max size of value of the item by parameter <b>max_size</b>.
if we don't call <b><a href="./ebmultiform.html#addPostItem">addPostItem</a>(&nbsp;)</b>, while <b><a href="./ebmultiform.html#dopost">dopost</a>(&nbsp;)</b> find a new one 
it will insert that and limit the max size 256 bytes.
<p>
</blockquote><h4>RETURNS</h4><blockquote><p>
OK/ERROR
</blockquote><h4>SEE ALSO</h4><blockquote><p>
<b><a href="./ebmultiform.html#top">ebmultiform</a></b>

<hr>
<a name="getPostItemValue"></a>
<p align=right>
<a href="rtnIndex.htm"><i>eyBuildLib :  Routines</i></a></p>

</blockquote><h1>getPostItemValue(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  
<p><strong>getPostItemValue(&nbsp;)</strong> - get post item value by item name</p>

</blockquote><h4>SYNOPSIS</h4><blockquote><p>
<pre>char * getPostItemValue
    (
    THIS_POST * p_post,       /* where get from */
    char *      name          /* name of item */
    )
</pre>

</blockquote><h4>DESCRIPTION</h4><blockquote><p>
this routine is to get post item value by item name
<p>
</blockquote><h4>RETURNS</h4><blockquote><p>
pointer to item value, or NULL if no such item
</blockquote><h4>SEE ALSO</h4><blockquote><p>
<b><a href="./ebmultiform.html#top">ebmultiform</a></b>

<hr>
<a name="getPostFileCount"></a>
<p align=right>
<a href="rtnIndex.htm"><i>eyBuildLib :  Routines</i></a></p>

</blockquote><h1>getPostFileCount(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  
<p><strong>getPostFileCount(&nbsp;)</strong> - get the number of files uploaded</p>

</blockquote><h4>SYNOPSIS</h4><blockquote><p>
<pre>int getPostFileCount
    (
    THIS_POST * p_post        /* where get from */
    )
</pre>

</blockquote><h4>DESCRIPTION</h4><blockquote><p>
this routine is get the number of files uploaded
<p>
</blockquote><h4>RETURNS</h4><blockquote><p>
get the number of files uploaded
</blockquote><h4>SEE ALSO</h4><blockquote><p>
<b><a href="./ebmultiform.html#top">ebmultiform</a></b>

<hr>
<a name="getPostSrcFileName"></a>
<p align=right>
<a href="rtnIndex.htm"><i>eyBuildLib :  Routines</i></a></p>

</blockquote><h1>getPostSrcFileName(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  
<p><strong>getPostSrcFileName(&nbsp;)</strong> - get source file name by index from post</p>

</blockquote><h4>SYNOPSIS</h4><blockquote><p>
<pre>char * getPostSrcFileName
    (
    THIS_POST * p_post,       /* where get from */
    int         index         /* index in file list */
    )
</pre>

</blockquote><h4>DESCRIPTION</h4><blockquote><p>
this routine return the file name remote user posted by index, 
the index should less than the retuned value by <b><a href="./ebmultiform.html#getPostFileCount">getPostFileCount</a>(&nbsp;)</b>.
<p>
</blockquote><h4>RETURNS</h4><blockquote><p>
pointer to the filename, or NULL if index is out of range
</blockquote><h4>SEE ALSO</h4><blockquote><p>
<b><a href="./ebmultiform.html#top">ebmultiform</a></b>

<hr>
<a name="movePostFile"></a>
<p align=right>
<a href="rtnIndex.htm"><i>eyBuildLib :  Routines</i></a></p>

</blockquote><h1>movePostFile(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  
<p><strong>movePostFile(&nbsp;)</strong> - move post file by index to specified directory</p>

</blockquote><h4>SYNOPSIS</h4><blockquote><p>
<pre>int movePostFile
    (
    THIS_POST * p_post,       /* where get from */
    int         index,        /* index in file list */
    char *      copyto        /* where copy to, path or filename */
    )
</pre>

</blockquote><h4>DESCRIPTION</h4><blockquote><p>
this routine move post file by index to specified directory, the index 
should less than the retuned value by <b><a href="./ebmultiform.html#getPostFileCount">getPostFileCount</a>(&nbsp;)</b>.
<p>
if you given only file path in <b>copyto</b> (eg: ../upload/), this routine 
will append file name the same as uploaded, othersize will be rename 
as specified by <b>copyto</b>, eg:
<pre>movePostFile(p_post, index, "../upload/");         
movePostFile(p_post, index, "../upload/xx.doc");   
</pre>

</blockquote><h4>NOTE</h4><blockquote><p>
<p>
this routine will try to replace the exist file 
<p>
</blockquote><h4>RETURNS</h4><blockquote><p>
OK if success, othersize a none zero will be returned.
</blockquote><h4>SEE ALSO</h4><blockquote><p>
<b><a href="./ebmultiform.html#top">ebmultiform</a></b>

<hr>
<a name="createPostParam"></a>
<p align=right>
<a href="rtnIndex.htm"><i>eyBuildLib :  Routines</i></a></p>

</blockquote><h1>createPostParam(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  
<p><strong>createPostParam(&nbsp;)</strong> - create a struct to hold post parameters</p>

</blockquote><h4>SYNOPSIS</h4><blockquote><p>
<pre>POST_PARAM * createPostParam
    (
    int    max_post_size,     /* max post size */
    int    file_max_size,     /* max size each file */
    int    max_file_number,   /* max file may uploads */
    char * upload_tmp_dir,    /* where to store temp */
    int    options            /* other options */
    )
</pre>

</blockquote><h4>DESCRIPTION</h4><blockquote><p>
this routine create a struct to hold those parameters, if less or equal
zero or NULL, it will be set to default value, as:
<pre>  max_post_size           2M
  file_max_size           1M
  max_file_number         1
  upload_tmp_dir          system temp directory
  options                 NONE
</pre>

</blockquote><h4>RETURNS</h4><blockquote><p>
pointer to this parameter struct, or NULL if lack memory
</blockquote><h4>SEE ALSO</h4><blockquote><p>
<b><a href="./ebmultiform.html#top">ebmultiform</a></b>

<hr>
<a name="distoryPostParam"></a>
<p align=right>
<a href="rtnIndex.htm"><i>eyBuildLib :  Routines</i></a></p>

</blockquote><h1>distoryPostParam(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  
<p><strong>distoryPostParam(&nbsp;)</strong> - free post parameters</p>

</blockquote><h4>SYNOPSIS</h4><blockquote><p>
<pre>void distoryPostParam
    (
    POST_PARAM * p_param
    )
</pre>

</blockquote><h4>DESCRIPTION</h4><blockquote><p>
this route is to free post parameters. 
if <b><a href="./ebmultiform.html#distoryPost">distoryPost</a>(&nbsp;)</b> is called, this routine will be called by it.
</blockquote><h4>NOTE</h4><blockquote><p>
you should not call this after call <b><a href="./ebmultiform.html#distoryPost">distoryPost</a>(&nbsp;)</b> 
<p>
</blockquote><h4>RETURNS</h4><blockquote><p>
NONE
</blockquote><h4>SEE ALSO</h4><blockquote><p>
<b><a href="./ebmultiform.html#top">ebmultiform</a></b>

<hr>
<a name="installPostHook"></a>
<p align=right>
<a href="rtnIndex.htm"><i>eyBuildLib :  Routines</i></a></p>

</blockquote><h1>installPostHook(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  
<p><strong>installPostHook(&nbsp;)</strong> - install hooks and cookie to this post</p>

</blockquote><h4>SYNOPSIS</h4><blockquote><p>
<pre>int installPostHook
    (
    POST_PARAM *     p_param,   /* where store to */
    FUNC_ON_DOHEADER on_header, /* user hook */
    FUNC_ON_DODATA   on_data,   /* user hook */
    FUNC_ON_DOEND    on_end,    /* user hook */
    void *           cookie     /* user data struct */
    )
</pre>

</blockquote><h4>DESCRIPTION</h4><blockquote><p>
this routine is to install user hooks and cookie to this post. 
when parse each post-part-header will call <b>on_header( )</b>, 
if the value hooks <b>on_header(&nbsp;)</b> returned:
<pre>  a. < 0  - return error
  b. > 0  - user hooks (on_body(), on_end()) will done this part
  c. = 0  - user hooks (on_body(), on_end()) will give up done this part
</pre>

</blockquote><h4>RETURNS</h4><blockquote><p>
OK/ERROR
</blockquote><h4>SEE ALSO</h4><blockquote><p>
<b><a href="./ebmultiform.html#top">ebmultiform</a></b>

<hr>
<a name="dopost"></a>
<p align=right>
<a href="rtnIndex.htm"><i>eyBuildLib :  Routines</i></a></p>

</blockquote><h1>dopost(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  
<p><strong>dopost(&nbsp;)</strong> - read post data and parse it</p>

</blockquote><h4>SYNOPSIS</h4><blockquote><p>
<pre>THIS_POST * dopost
    (
    POST_PARAM * p_param,     /* page post prameters */
    char *       errmsg       /* to return error */
    )
</pre>

</blockquote><h4>DESCRIPTION</h4><blockquote><p>
this routine read post data and parse it, store the result into 
file-list and item-list and return a handle pointer to it.
<p>
we can limit item max size by call <b><a href="./ebmultiform.html#addPostItem">addPostItem</a>(&nbsp;)</b> before call this 
routine. if we don't limit the size, system will limit the item with 
default size <b>EB_ITEM_DEFAULT_SIZE</b> (include tail '\0')
<p>
</blockquote><h4>NOTE</h4><blockquote><p>
encode type (ENCTYPE) must be <b>multipart/form-data</b>. 
<p>
</blockquote><h4>RETURNS</h4><blockquote><p>
pointer to the relust parsed, or NULL if error
</blockquote><h4>SEE ALSO</h4><blockquote><p>
<b><a href="./ebmultiform.html#top">ebmultiform</a></b>

<hr>
<a name="distoryPost"></a>
<p align=right>
<a href="rtnIndex.htm"><i>eyBuildLib :  Routines</i></a></p>

</blockquote><h1>distoryPost(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  
<p><strong>distoryPost(&nbsp;)</strong> - free this post</p>

</blockquote><h4>SYNOPSIS</h4><blockquote><p>
<pre>void distoryPost
    (
    THIS_POST * p_post,       /* current post */
    BOOL        isremove      /* remove files in temp_dir or not */
    )
</pre>

</blockquote><h4>DESCRIPTION</h4><blockquote><p>
this routine will free all the file-list and item list, 
it will also call <b><a href="./ebmultiform.html#distoryPostParam">distoryPostParam</a>(&nbsp;)</b> to free the post parameter.
<p>
</blockquote><h4>RETURNS</h4><blockquote><p>
NONE
</blockquote><h4>SEE ALSO</h4><blockquote><p>
<b><a href="./ebmultiform.html#top">ebmultiform</a></b>

</body>
</html>



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -