pub fn add_file<I: Into<String>, P: Into<PathBuf>>(&mut self, name: I, path: P) {
        let buf = path.into();

        let name = name.into();

        let filename = buf
            .file_name()
            .expect("Should be a valid file")
            .to_string_lossy()
            .to_string();
        let content_type = mime_guess::MimeGuess::from_path(&buf)
            .first_or_octet_stream()
            .to_string();
        let stream = FileStream::new(buf);

        self.add_stream(name, filename, content_type, stream);
    }
/// Add a FileStream to a MultipartRequest given a path to a file
///
/// This will guess the Content Type based upon the path (i.e, .jpg will be `image/jpeg`)
Add a FileStream to a MultipartRequest given a path to a file
This will guess the Content Type based upon the path
Add a FileStream to a MultipartRequest given a path to a file This will guess the Content Type based upon the path
pub fn add_file<I: Into<String>, P: Into<PathBuf>>(&mut self, name: I, path: P) {
        let buf = path.into();
        let name = name.into();
        let filename = buf
            .file_name()
            .expect("Should be a valid file")
            .to_string_lossy()
            .to_string();
        let content_type = mime_guess::MimeGuess::from_path(&buf)
            .first_or_octet_stream()
            .to_string();
        let stream = FileStream::new(buf);
        self.add_stream(name, filename, content_type, stream);
    }
pub fn add_file < I : Into < String > , P : Into < PathBuf > > ( & mut self , name : I , path : P ) { let buf = path . into ( ) ; let name = name . into ( ) ; let filename = buf . file_name ( ) . expect ( " " ) . to_string_lossy ( ) . to_string ( ) ; let content_type = mime_guess :: MimeGuess :: from_path ( & buf ) . first_or_octet_stream ( ) . to_string ( ) ; let stream = FileStream :: new ( buf ) ; self . add_stream ( name , filename , content_type , stream ) ; }
Add a FileStream to a MultipartRequest given a path to a file
This will guess the Content Type based upon the path (i.e, .jpg will be `image/jpeg`)
Add a FileStream to a MultipartRequest given a path to a file This will guess the Content Type based upon the path ( i . e . jpg will be ` image / jpeg ` )
&mut self
name
I
path
P