File upload doesn't works from Android browser

417 views Asked by At

File upload doesn't works from Android browser but works fine in PC browser. my MVC code work good in local IIS express

 [HttpPost]
public string UploadJson(string id)
{

    try
    {
        string uploadFial = "noSave";
        if (Request.Files.Count > 0)
        {
            var file = Request.Files[0];

            if (file != null && file.ContentLength > 0)
            {
                if (string.IsNullOrWhiteSpace(id)) id = Request.Params["id"];
                string fileName = id + Path.GetExtension(file.FileName);
                string path =  Path.Combine(Server.MapPath("~/Images/"), fileName);
                logPath = Path.Combine(Server.MapPath("~/Images/"), "log.txt");
                file.SaveAs(path);
                return (Request.Url.ToString().Replace(Request.RawUrl.ToString(), "")
              + "/Images/" + fileName);
            }
            else { return (uploadFial); }
        }
        else
        { return (uploadFial); }
    }
    catch (Exception e)
    {

        saveLog(  e.InnerException + "stack trace **" + e.StackTrace+"data **" +e.Data.ToString());
        throw e;
    }

}

<form action="~/Home/UploadJson/" id="form6" enctype="multipart/form-data" data_ajax="false" method="post">
    <input type="file" name="file" />
    <input type="submit" value="upload file ready" />
</form>

also I set in web config server :

<httpRuntime targetFramework="4.5" maxRequestLength="2147483647" executionTimeout="1600" requestLengthDiskThreshold="2147483647" />

but upload file from Android browser to IIS server doesn't works.

1

There are 1 answers

0
babak3548 On BEST ANSWER

There was nothing to do with programming The problem was the size of the pack is set for MUT on server Solved with set MUT size on command prompt in server to default value 1350

netsh interface ipv4 set subinterface 10 mtu=1350 store=persistent