0

asp.net 上传控件是第一次在 Ipad 中上传文件,但之后没有上传,甚至没有显示任何错误

代码如下

protected void UploadThisFile(FileUpload upload)
    {
        try
        {

            string folderpath = ConfigurationManager.AppSettings["BTCommDynamic"].ToString() + ConfigurationManager.AppSettings["Attachments"].ToString();
            Guid fileguid = Guid.NewGuid();
            string filename = fileguid + upload.FileName;
            if (upload.HasFile && dtFiles != null)
            {

                DataRow drFileRow = dtFiles.NewRow();
                drFileRow["FileName"] = upload.FileName;
                string theFileName = Path.Combine(Server.MapPath(folderpath), filename);
                string theFileName1 = Path.Combine(folderpath, filename);
                //string theFileName = folderpath;
                //to save the file in specified path
                upload.SaveAs(theFileName);
                drFileRow["FilePath"] = theFileName1;
                double Filesize = (upload.FileContent.Length);
                if (Filesize > 1024)
                {
                    drFileRow["FileSize"] = (upload.FileContent.Length / 1024).ToString() + " KB";
                }
                else
                {
                    drFileRow["FileSize"] = (upload.FileContent.Length).ToString() + " Bytes";
                }
                dtFiles.Rows.Add(drFileRow);
                gvAttachment.DataSource = dtFiles;
                gvAttachment.DataBind();
            }
        }
        catch (Exception ex)
        {
            string message = Utility.GetExceptionMessage(ex.GetType().ToString(), ex.Message);
            Display_Message(message);
        }

    }
4

1 回答 1

0

你用萤火虫吗?客户端可能存在错误,导致您的功能无法正常工作。你的客户端有什么逻辑吗?一些 jquery/ajax 调用?

于 2013-09-25T11:24:29.320 回答