Action()
{ web_reg_save_param("find_msg",
"LB=message\":\"",
"RB=\"",
"Ord=1",
LAST); //特殊情况需要加
web_add_header("Content-Type","multipart/form-data"); lr_start_transaction("ajax_upload"); web_submit_data("Attachments", "Action=http://localhost:8080/pinter/file/api/upload2", "Method=POST", "EncType=multipart/form-data", "TargetFrame=", "RecContentType=text/html", "Snapshot=t5.inf", "Mode=HTML", ITEMDATA, "Name=file", "Value=C:\\a.txt", "File=yes",
ENDITEM, LAST ); //utf8->转化为本地解码
lr_convert_string_encoding(lr_eval_string("{find_msg}"), LR_ENC_UTF8, LR_ENC_SYSTEM_LOCALE, "msg"); if(strcmp(lr_eval_string("{msg}"),"上传成功") == ){
lr_end_transaction("ajax_upload", LR_PASS); }else{
lr_end_transaction("ajax_upload", LR_FAIL); } return ;
}

运行日志如下:

 Virtual User Script started at : -- ::
Starting action vuser_init.
Web Turbo Replay of LoadRunner 11.0. for WINXP; build (Aug ::) [MsgId: MMSG-]
Run Mode: HTML [MsgId: MMSG-]
Run-Time Settings file: "C:\test_huzhenyu\Script\upload_ajax\\default.cfg" [MsgId: MMSG-]
Ending action vuser_init.
Running Vuser...
Starting iteration .
Starting action Action.
Action.c(): Registering web_reg_save_param was successful [MsgId: MMSG-]
Action.c(): Warning -: The header being added may cause unpredictable results when applied to all ensuing URLs. It is added anyway [MsgId: MWAR-]
Action.c(): web_add_header("Content-Type") highest severity level was "warning" [MsgId: MMSG-]
Action.c(): Notify: Transaction "ajax_upload" started.
Action.c(): t=553ms: -byte response headers for "http://localhost:8080/pinter/file/api/upload2" (RelFrameId=, Internal ID=)
Action.c(): HTTP/1.1 \r\n
Action.c(): Content-Type: application/json;charset=UTF-\r\n
Action.c(): Transfer-Encoding: chunked\r\n
Action.c(): Date: Fri, Mar :: GMT\r\n
Action.c(): \r\n
Action.c(): t=581ms: -byte chunked response overhead for "http://localhost:8080/pinter/file/api/upload2" (RelFrameId=, Internal ID=)
Action.c(): \r\n
Action.c(): t=590ms: -byte chunked response overhead for "http://localhost:8080/pinter/file/api/upload2" (RelFrameId=, Internal ID=)
Action.c(): \r\n
Action.c(): \r\n
Action.c(): \r\n
Action.c(): t=621ms: -byte chunked response body for "http://localhost:8080/pinter/file/api/upload2" (RelFrameId=, Internal ID=)
Action.c(): {"code":"","message":"涓婁紶鎴愬姛","data":null}
Action.c(): Notify: Saving Parameter "find_msg = 涓婁紶鎴愬姛".
Action.c(): HTML parsing not performed for Content-Type "application/json" ("ParseHtmlContentType" Run-Time Setting is "TEXT"). URL="http://localhost:8080/pinter/file/api/upload2" [MsgId: MMSG-]
Action.c(): web_submit_data("Attachments") was successful, body bytes, header bytes, chunking overhead bytes [MsgId: MMSG-]
Action.c(): Notify: Parameter Substitution: parameter "find_msg" = "涓婁紶鎴愬姛"
Action.c(): Notify: Saving Parameter "msg = 上传成功\x00".
Action.c(): Notify: Parameter Substitution: parameter "msg" = "上传成功\x00"
Action.c(): Notify: Transaction "ajax_upload" ended with "Pass" status (Duration: 0.5931 Wasted Time: 0.4267).
Ending action Action.
Ending iteration .
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.

log

post接口_ajax上传的更多相关文章

  1. java微信接口之四—上传素材

    一.微信上传素材接口简介 1.请求:该请求是使用post提交地址为: https://api.weixin.qq.com/cgi-bin/media/uploadnews?access_token=A ...

  2. java微信接口之三—上传多媒体文件

    一.微信上传多媒体接口简介 1.请求:该请求是使用post提交from来实现的,我们可以在网页上进行表单提交来实现.地址为: http://file.api.weixin.qq.com/cgi-bin ...

  3. Python+requests库 POST接口图片上传

    捕获到POST接口的请求参数,如下: 包括data.file两个部分,上传代码如下: 比较简单,直接发送files参数即可 heads中 content-type 折腾了1个小时,呵呵

  4. 利用 python requests完成接口文件上传

    最近在准备一个公开课,主题就是利用不同的语言和不同的工具去实现文件的上传和下载. 在利用Jmeter去实现功能的时候,以及利用loadrunner去写脚本的时候,都很顺利,没有任何问题,当我尝试用Py ...

  5. Java文件上传:Restful接口接收上传文件,缓存在本地

    接口代码 import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.PostMapping; i ...

  6. el-upload控件一次接口请求上传多个文件

    el-upload组件默认情况下上传多少个文件就会请求多少次上传接口,如何一次上传多个文件而不必多次请求上传接口呢?直接看代码 html <el-upload :action="act ...

  7. C#post调用接口并上传文件

    /// <summary> /// C#调用接口上传json数据,并且带文件上传 /// </summary> /// <param name="url&quo ...

  8. 微信开发平台中有个接口是上传多媒体文件,我用的是java 开发的,我怎么样才能在后台实现呢?

    /**      * 文件上传到微信服务器      * @param fileType 文件类型      * @param filePath 文件路径      * @return JSONObj ...

  9. delphi请求http接口并上传附件

    实现附件的上传:需要使用TIdMultiPartFormDataStream控件, uses IdMultipartFormData; 例子: procedure TClientForm.Button ...

随机推荐

  1. Jmeter--HTTPS请求

    (1)新建threadGroup:                               (2)设置并发用户数量:                                     (3) ...

  2. react native基本调试技巧

    刚入坑RN,很多小坑都要摸索很久才明白.今天咱们就来填console.log()的坑. 废话不多说,开始讲步骤!! 1.在模拟器中打开 开发者菜单,选择 Debug JS Remotely,会自动在浏 ...

  3. 禁用Linux透明大页

    Oracle 安装时官方建议关闭Linux的透明大页,防止内存延迟分配导致的性能问题 https://docs.oracle.com/cd/E11882_01/install.112/e47689/p ...

  4. 苹果内购小结 - iOS

    此篇针对 iOS 支付进行一次小结,很久没碰这块了,有些方法 Apple 官方也进行了优化,故也将随之进行更新. 首先,code 部分将分为两部分,一部分在 appdelegate 中,另一部分单独封 ...

  5. 我的前端工具集(七)div背景网格

    我的前端工具集(七)div背景网格   liuyuhang原创,未经允许禁止转载 目录 我的前端工具集 有时候总觉得div颜色过于白,于是给了10%的灰 但是并不一定能解决问题,因为页面中会有不均衡的 ...

  6. 个人免签收款接口 bufpay.com 支持限额设置

    有产品希望收款分布到不同的手机,每个当手机达到某一限额以后就停止改手机的收款. bufpay.com 近期上线了收款限额设置功能,配置界面如下图: 每个手机微信或支付宝可以单独设置每日限额,如果该手机 ...

  7. parsing XML document from class path resource [applicationtext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationtext.xml] cannot be opened because it does not e

    控制台异常: parsing XML document from class path resource [applicationtext.xml]; nested exception is java ...

  8. Canvas状态的保存与恢复

    Canvas的API提供了save()和restore()的方法,用于保存及恢复当前canvas绘图环境的所有属性. save()与restore()方法可以嵌套调用 save()方法将当前绘图环境压 ...

  9. IO流之字符流

    字符流产生的原因: 1.每次只能够读取一个字节或者一个字节数组,每次在需要转换成字符或者字符串的时候不是很方便2.不同的操作系统针对换行符的处理不方便3.有的时候会出现中文乱码(中文占两个字节,如果针 ...

  10. CAT 安装运行配置教程

    CAT安装教程 首先安装mysql数据库,具体步骤参阅<mysql免安装教程>--http://www.cnblogs.com/halberts/p/8723938.html 下载CAT代 ...