我有从POST接收图像的PHP代码:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int strg_len2(char *s);
int main(void)
{
/* Declare variables. */
char strg1[] = "This is one string ";
char strg2[] = "and this is a second string";
char *strg3 = /* allocate memory dynamically */
/* Print the strg1, strg2 and their lengths. */
// printf("String 1 : %s\nString 2 : %s\n", strg1, strg2);
printf("String 1 : %s and Its length is %i \nString 2 : %s and its length is %i\n", strg1, strlen(strg1), strg2, strlen(strg2));
/* Allocate memory for strg3 */
strg3 = (char*) malloc((strlen(strg1)+strlen(strg2)*sizeof(char)));
/* Combine the strings (strg1 and strg2) to strg3*/
strcpy(strg3,strg1);
strcat(strg3,strg2);
/*print strg3 and its length */
printf("%s, now length of string 3 is : %i\n", strg3, strlen(strg3));
/* strncat() - add only 10 char of strg2 to strg1 and store them into strg3 */
printf("\nContatanation of String 1 And 10 characters of string 2 : %s", strncat(strg1, strg2,10));
strg3 = strncat(strg1, strg2,10);
/*print strg3 and its length */
printf("%s\t%i", strg3, strlen(strg3));
} /*end main()*/
在Android上,我需要获取ImageView中显示的图像并将其发送到服务器上的PHP脚本。对于iOS,我使用POST请求和multipart / form-data创建了代码。但在Android上我找不到办法做到这一点。