C# 如何消除我的POST请求中查询字符串的超长?

C# 如何消除我的POST请求中查询字符串的超长?,c#,post,uwp,C#,Post,Uwp,用于将base64映像发送到服务器,有时会遇到超出最大行长度的问题。如何避免 我的邮政编码: var values = new Dictionary<string, string> { { "kod", "111" }, { "id_user", user.Id }, { "image", encodedFile }, { "title", "MyText" }, { "text", "

用于将base64映像发送到服务器,有时会遇到超出最大行长度的问题。如何避免

我的邮政编码:

 var values = new Dictionary<string, string>
       {
        { "kod", "111" },
        { "id_user", user.Id },
        { "image", encodedFile },
        { "title", "MyText" },
        { "text", "1234526" }
       };

        var content = new System.Net.Http.FormUrlEncodedContent(values);

        var response = await client.PostAsync("http://MyUri/tape.php", content);

        var responseString = await response.Content.ReadAsStringAsync();
var值=新字典
{
{“kod”,“111”},
{“id_user”,user.id},
{“图像”,编码文件},
{“标题”,“我的文字”},
{“文本”,“1234526”}
};
var content=new System.Net.Http.FormUrlEncodedContent(值);
var response=wait client.PostAsync(“http://MyUri/tape.php“,内容);
var responseString=await response.Content.ReadAsStringAsync();

我请求的完整代码:

private async void Send_File_But(object sender, RoutedEventArgs e)
    {
        FileOpenPicker open = new FileOpenPicker();
        open.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
        open.ViewMode = PickerViewMode.Thumbnail;

        // Filter to include a sample subset of file types
        open.FileTypeFilter.Clear();
        open.FileTypeFilter.Add(".bmp");
        open.FileTypeFilter.Add(".png");
        open.FileTypeFilter.Add(".jpeg");
        open.FileTypeFilter.Add(".jpg");

        // Open a stream for the selected file
        StorageFile file = await open.PickSingleFileAsync();

        var stream = await file.OpenStreamForReadAsync();
        var bytes = new byte[(int)stream.Length];
        stream.Read(bytes, 0, (int)stream.Length);

        string encodedFile = Convert.ToBase64String(bytes);



        var values = new Dictionary<string, string>
       {
        { "kod", "111" },
        { "id_user", user.Id },
        { "image", encodedFile },
        { "title", "MyText" },
        { "text", "1234526" }
       };

        var content = new System.Net.Http.FormUrlEncodedContent(values);

        var response = await client.PostAsync("http://MyUri/tape.php", content);

        var responseString = await response.Content.ReadAsStringAsync();


    }
private async void Send\u File\u但是(对象发送方,RoutedEventArgs e)
{
FileOpenPicker open=新建FileOpenPicker();
open.SuggestedStartLocation=PickerLocationId.PicturesLibrary;
open.ViewMode=PickerViewMode.缩略图;
//筛选以包括文件类型的示例子集
open.FileTypeFilter.Clear();
open.FileTypeFilter.Add(“.bmp”);
open.FileTypeFilter.Add(“.png”);
open.FileTypeFilter.Add(“.jpeg”);
open.FileTypeFilter.Add(“.jpg”);
//打开选定文件的流
StorageFile文件=等待打开。PickSingleFileAsync();
var stream=await file.OpenStreamForReadAsync();
var bytes=新字节[(int)stream.Length];
读取(字节,0,(int)stream.Length);
string encodedFile=Convert.tobase64字符串(字节);
var值=新字典
{
{“kod”,“111”},
{“id_user”,user.id},
{“图像”,编码文件},
{“标题”,“我的文字”},
{“文本”,“1234526”}
};
var content=new System.Net.Http.FormUrlEncodedContent(值);
var response=wait client.PostAsync(“http://MyUri/tape.php“,内容);
var responseString=await response.Content.ReadAsStringAsync();
}

是什么导致了错误?你的内容是否真的像我预期的那样在请求正文中发送?(如果是这样的话,我不希望有任何限制。)当我选择“大图像”时会产生这个错误。这并不是说是什么产生了错误。它是在PHP中,还是在客户端?您在标题中提到了查询字符串-您是否建议这是发布到一个长URL?可能是重复的,那么它是如何“显示”的?基本上你没有给我们提供信息。