A
A
andrey_levushkin2020-04-13 13:10:01
css
andrey_levushkin, 2020-04-13 13:10:01

Why can't I upload a file from a folder to the server via UploadFile?

I'm trying to upload a file from the TEST folder in the root of the program to the server

var wc = new WebClient();
var responseFile = Encoding.ASCII.GetString(wc.UploadFile(p, "TEST\\test.txt"));  // p - адрес загрузки

Gives an error message
"{\"error\":\"empty_file\",\"error_descr\":\"empty_file\",\"error_is_logged\":false}"

But if you try to download a file from the root folder of the program, and not from a subfolder, then everything works out
var wc = new WebClient();
var responseFile = Encoding.ASCII.GetString(wc.UploadFile(p, "test.txt"));  // p - адрес загрузки

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dymok, 2019-10-21
@Dmitr66

You can try this option5dacd52ec5997105625586.jpeg

A
andrey_levushkin, 2020-04-13
@andrey_levushkin

The problem was that the files were empty. After filling the file with information - everything turned out.

T
twobomb, 2020-04-13
@twobomb

Try

var responseFile = Encoding.ASCII.GetString(wc.UploadFile(p, @".\TEST\test.txt"));  // p - адрес загрузки

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question