Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Form post data to ASHX hidden fields

Tags:

asp.net

ashx

I have next form and some ashx

 <form action="FileUpload.ashx" method="POST" enctype="multipart/form-data" id="frmUpload">
        <input id="fileupload" type="file" name="files[]" />
        <input id="viewId" type="hidden" />
        <input id="moduleId" type="hidden" />
        <button id="btnUpload" type="submit">Upload</button>
    </form>

I can get file inside of ProcessRequest(HttpContext context) context.Request.Files - file containe file information, but context.Request.Form["viewId"] is empty. That should I do to get hidden fields values ?

Thanks.

like image 928
Arbejdsglæde Avatar asked Jan 23 '26 10:01

Arbejdsglæde


1 Answers

You need to add the name="viewid" also. The name attribute is used when you make post, not the id

read also: HTML input - name vs. id in the line "Used on form elements to submit information"

like image 56
Aristos Avatar answered Jan 26 '26 00:01

Aristos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!