How to dynamically set value for asp.net download control?

I have a file upload control. I select an image using the control and save it to the database. In edit mode, I need to assign an image path in the file upload control text box. Is this possible ?? If so, how can I achieve this?

Regards, Srinivas.

+3
source share
2 answers

No, it is not possible to set the initial value for an element <input type="file" />. The reason for this limitation (which is applied by the browser, not ASP.NET) is security. Consider the consequences of a malicious website owner by posting the following on the form:

<input type="file" value="c:\bank\secret.key" />

However, I am not sure if this limitation is indeed a problem in the scenario you are describing. The presence of a <input type="file">pre-filled path to the image file on the server is unlikely to help in any case, since the value selected in the file field is used to indicate the file on the client that will be downloaded as part of the postback form.

, (, ) <input type="file"> , ( ).

+5

, , . -

0

Source: https://habr.com/ru/post/1742579/


All Articles