Upload to PHP server from c sharp client application

后端 未结 2 1502
悲哀的现实
悲哀的现实 2020-12-15 07:17

Currently i have a c sharp application (Client app). and a web application written php. I want to transfer some files whenever a particular action is performed at client sid

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-15 07:48

    Your current PHP code is for handling multiple file uploads, but your C# code is only uploading one file.

    You need to modify your PHP code somewhat, removing the foreach loop:

    
    

    You also need to ensure that the ./files directory exists.

    I have tested the above PHP code with your C# code and it worked perfectly.

    • For more information on handling file uploads, refer to the PHP documentation.

    • For more information on uploading multiple files with C# and PHP, here are some helpful links:

      Upload files with HTTPWebrequest (multipart/form-data)

      Use Arrays in HTML Form Variables

      PHP: Uploading multiple files

      If you want something simple for uploading multiple files, you just just upload one file at a time to upload.php in a C# loop.

提交回复
热议问题