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. TortoiseSVN 分支创建与合并

    前提准备: 确保本地Work Copy 和 服务器上的 版本一致.( 所有代码都提交到SVN,并update一次) 1  从主干创建分支代码 在本地Work Copy  选中项目文件夹,鼠标右键选择 ...

  2. C# 类中的静态字段始终继承自基类

    我们试想一下现在有一个类Parent,它有一个static的int类型字段number,然后如果类Parent有三个子类Child01.Child02和Child03,那么改变Parent.numbe ...

  3. Java 编码规范(转)

    本文转自:http://www.javaranger.com/archives/390 文章总结出了java编码过程中的一些规范,以便参考. 1.合理组织代码层次,分层清晰:controller.lo ...

  4. Office365学习笔记—创建WikiPage

    1,项目有个需求:项目表每更新一次,就把跟该项目有关的任务创建一个静态页(历史版本功能)! 注意事项:需要在页面上拖一个ContentEditer!将代码放在ContentEditer里面,因为我试过 ...

  5. html中defer和window.onload的加载顺序

    结论:defer执行的顺序先于window.onload! 案例: html代码: <!DOCTYPE html> <html lang="en"> < ...

  6. oracle11g的安装与卸载

    1.首先确认电脑已安装 .NET Framework3.5 2.本地计算机的安装: 参考:https://www.cnblogs.com/hoobey/p/6010804.html 3.服务器的安装: ...

  7. BZOJ2298: [HAOI2011]problem a(带权区间覆盖DP)

    Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 1747  Solved: 876[Submit][Status][Discuss] Descripti ...

  8. Dubbo 改造普通单体项目

    一.新建普通maven项目 1.首先,新建3个普通maven商城项目,模拟以往常见的Java单体应用开发,mall-interface是存放接口和公共代码部分,order-service-consum ...

  9. Linq 综合写法

    var queryCount = (from pv in db.Province join pc in (from cc in         ((from v in db.ERPStockProdu ...

  10. Zookeeper -- 本地\完全分布式 搭建

    准备工作 linux软件:Zookeeper-3.4.12.tar.gz 四台centos系统虚拟机,主机名为:s101~s104 一.本地模式搭建(s101上安装) 1.解压软件压缩包:解压到根目录 ...