php - WinInet上传文件PHP
问题描述
我有以下问题,我是如何通过 Wininet.dll 发送图像的新手。
我正在使用 metatrader 4(C 语言),并且我与 PHP 的连接成功,但我没有在服务器上收到附件。
附上代码:
元交易者 4:
string frmdata = "-----------------------------7d82751e2bc0858\r\nContent-Disposition: form-data; name=\"uploadedfile\"; filename=\"C:\\Users\descarga.png\"\r\nContent-Type: "+filetype+"\r\n\r\nfile contents here\r\n-------------------------------7d82751e2bc0858\r\n";
string hdrs = "Content-Type: multipart/form-data; boundary=---------------------------7d82751e2bc0858";
#import "Wininet.dll"
int HttpOpen = InternetOpenW(InternetAgent, Internet_Open_Type_Direct, "0", "0", "0");
int HttpConnect = InternetConnectW(HttpOpen, "Localhost", 8080, "", "", 3, 0, 1);
int HttpRequest = HttpOpenRequestW(HttpConnect, "POST", "/ConnectMT4/funcphp/screenpost.php", "HTTP/1.1", "", acceptTypes, 0, 1);
bool result = HttpSendRequestW(HttpRequest, hdrs, StringLen(hdrs), frmdata, StringLen(frmdata));
int read[1];
Print("This is the POST result: ", result);
InternetCloseHandle(HttpOpen);
InternetCloseHandle(HttpRequest);
}
return(res==200);
}
PHP 文件:
<?php
$desprendible = $_FILES["uploadedfile"];
if ($_FILES['uploadedfile']['name'] != null) {
echo "Tiene datos La variable";
}else{
echo "No hay datos";
}
?>
PHP代码,我一直在尝试不同的代码,这是我拥有的最后一个。PHP文件调试的附件照片:https ://prnt.sc/1mm1oh1
解决方案
推荐阅读
- mongodb - MongoDB查询以检索包含数组中特定元素的所有行
- c - 禁止从源头移动到目的地的河内塔 (C)
- python - PyUSB:从 USB 设备读取
- php - PHP:如何将 JSON 键转换为值
- python - 在另一个输入变量中引用一个输入变量
- python - scipy.ndimage.gaussian_gradient_magnitude 和 gaussian_filter 函数之间的区别
- vscode-extensions - 如何删除vscode片段中的行内容
- php - PHP输入问题
- node.js - 使用 mongoose 将图像或背景图像列表保存在 momgodb 中并检索作为图像输入的选择,以附加在用户帖子上
- php - 级联用户删除 laravel