Files Upload

Hi,
I have many txt files in a specific directory and i want to upload these files one at the time in my config, i want to read content and if i found a specific value means is a valid file.
I need to learn how can i upload one at the time all files stored in a custom directory.
Thank’s.

Uploading usually depends on the website, but most websites require you to send a multipart request. Maybe sniff the site first and then try to understand how it wants them. After that you can just use this simple C# command to get all the paths of the files in that folder.

List<string> files = System.IO.Directory.EnumerateFiles("path/to/your/dir").ToList();

Finally make a foreach loop and upload each one of them using the multipart request and the path of the file.

Thank’s for your reply but I badly explained myself…Sorry.
I need not to upload files on the website but i need to upload files in my config one at the time.

I don’t think I understood, can you make an example or a sample config?

I have a directory in my pc with many cookies txt files.
I need to upload they, one at the time, in my config and i need to check if are valid cookies.

Ok well the technique is the same

  1. Get a list of all the files in the directory
List<string> files = System.IO.Directory.EnumerateFiles("path/to/your/dir").ToList();
  1. Do a foreach loop
FOREACH file IN files
// blocks go here
END
  1. In the “blocks go here” part, use a block to read the file’s content (its path will be in the variable called file) to grab the cookie, then use an Http Request block to send the request using the cookie (interpolated mode). Finally, use an IF statement to check if the cookie was ok basing on the response, and then do what you want with it.
1 Like