Loadrunner上传文件解决办法(大文件)
Loadrunner上传文件解决办法(大文件)
web_submit_data("importStudent.do",
"Action=https://testserver/console/importStudent.do",
"Method=POST",
"EncType=multipart/form-data",
"RecContentType=text/html",
"Referer=https://testserver/console/displayStudentList.do",
"Snapshot=t12.inf",
"Mode=HTTP",
ITEMDATA,
"Name=uploadFile", "Value=D://Excel//data161955.zip", "File=yes", ENDITEM,
LAST);
|
vuser_init()
{
char fileName[] = "D:/Script/CreateObj_10M/tools.zip";
int len = 0;
int readLen=0;
int tmpLen=1;
int runLen =104857;
int cLen = 0;
if ( (file_stream = fopen(fileName, "rb")) == NULL)
{
lr_message("open file failed!\n");
return -1;
}
fseek(file_stream, 0, 2);
len = ftell(file_stream);
lr_message("file length is: %d bytes", len);
readbuf = (char *) malloc(len+1);
memset(readbuf, 0, len+1);
if ( runLen > len) {
runLen = len;
}
fseek(file_stream, 0, 0);
while(feof(file_stream)== 0){
tmpLen = fread(readbuf + readLen, 1,runLen , file_stream);
readLen += tmpLen;
cLen = readLen + runLen;
if (cLen > len) {
runLen = cLen - len;
}
if (tmpLen==0) {
break;
}
}
|
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。