Page 1 of 1

What to do when CefPostDataElement.ElementType is File?

PostPosted: Sun Aug 06, 2017 4:48 pm
by gwynjudd
Hello,

I'm trying to get some information about a CefRequest, and I've come across this case:

Code: Select all
var postData = request.PostData;
         if (postData != null && postData.Count > 0)
         {
            foreach (CefPostDataElement postDataElement in postData.GetElements()) {
               switch (postDataElement.ElementType)
               {
                  case CefPostDataElementType.Bytes:
                     var bytes = postDataElement.GetBytes();
                     this.WebRequest.GetRequestStream().Write(bytes, 0, bytes.Length);
                     break;
                  case CefPostDataElementType.File:
                     // not sure what to do in this case???
                     var file = postDataElement.GetFile();
                     break;
               }
            }
         }


Looking at the post data element type, what does it mean if the type is file? What does the return type of "GetFile()" indicate? The path to the file?

Re: What to do when CefPostDataElement.ElementType is File?

PostPosted: Mon Aug 07, 2017 11:44 am
by magreenblatt
GetFile() will return the file name for file uploads.