private void FinishFileData(HttpEntity entity)
        {
            if (uploaded_file == null)
                return;

            // Chop off the \r\n that gets appended before the boundary marker
            uploaded_file.Contents.SetLength (uploaded_file.Contents.Position - 2);
            uploaded_file.Finish ();

            if (uploaded_file.Length > 0)
                entity.Files.Add (current_name, uploaded_file);

            uploaded_file = null;
        }
Ejemplo n.º 2
0
        private void FinishFileData(HttpTransaction transaction)
        {
            if (uploaded_file == null)
                return;

            // Chop off the \r\n that gets appended before the boundary marker
            uploaded_file.Contents.SetLength (uploaded_file.Contents.Position - 2);

            uploaded_file.Finish ();
            transaction.Request.Files.Add (current_name, uploaded_file);
            uploaded_file = null;
        }
        public void ParseContentDisposition(string str)
        {
            current_name = GetContentDispositionAttribute (str, "name");
            current_filename = GetContentDispositionAttributeWithEncoding (str, "filename");

            if (!String.IsNullOrEmpty (current_filename))
                uploaded_file = file_creator.Create (current_filename);
        }
        public void ParseContentDisposition(string UTF8string, HttpEntity entity)
        {
            current_name = GetContentDispositionAttribute (UTF8string, "name");
            current_filename = GetContentDispositionAttribute (UTF8string, "filename");

            if (!String.IsNullOrEmpty (current_filename)) {
                string fileRef = null;
                if (entity is HttpRequest) {
                    Manos.Collections.DataDictionary queryData = null;
                    if (((HttpRequest) entity).QueryDataString.Length != 0) {
                        queryData = HttpUtility.ParseUrlEncodedData (((HttpRequest) entity).QueryDataString);
                    }
                    fileRef = queryData ["ref"];
                }
                uploaded_file = file_creator.Create (current_filename, fileRef, entity.Headers.ContentLength);
            }
        }