如何将文件上传到HTTP服务器(POST方法) [英] How to upload file to HTTP server (POST Method)

查看:198
本文介绍了如何将文件上传到HTTP服务器(POST方法)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!



如何使用POST方法将文件上传到HTTP服务器(php脚本)?



我需要在C ++中同时上传一些小文本文件。什么是PHP脚本?



请帮忙!

解决方案

如果HTML表单是什么的话像这样:

< form enctype =multipart / form-dataaction =script.phpmethod =POST> 
< input name =uploaded_file []type =file/>
< input name =uploaded_file []type =file/>
< input name =uploaded_file []type =file/>
< input type =submitvalue =上传/>
< / form>





然后PHP脚本将是:

 if(isset(


_FILES [' uploaded_file'])){ // 检查是否有文件上传
for


i = 0 ;

Hi all!

How I can upload file to an HTTP Server (php script) with POST Method?

I need to upload some small text files simultaneously in C++. What will be the PHP script?

Please, help!

解决方案

If the HTML form was something like this:

<form enctype="multipart/form-data" action="script.php" method="POST">
  <input name="uploaded_file[]" type="file" />
  <input name="uploaded_file[]" type="file" />
  <input name="uploaded_file[]" type="file" />
  <input type="submit" value="Upload" />
 </form>



Then the PHP script will be:

if(isset(


_FILES['uploaded_file'])){ // check if any file was uploaded for (


i = 0;


这篇关于如何将文件上传到HTTP服务器(POST方法)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆