form does not upload file

Asked

Viewed 33 times

0

I have a form that I need to upload to an ftp.

When I put the fashion down no file loads.

<form id="frmEnviar" name="frmEnviar" data-ajax="false" method="post" runat="server" enctype="multipart/form-data">

</form>

Already the form below loads file.

@using (Html.BeginForm("Inserir", "ProtocoloLatam", FormMethod.Post, new { enctype = "multipart/form-data" }))
{


}

Because the first way doesn’t work?

  • Add action="arquivo.ext" to see if it resolves, informing the file that will receive the request.

  • Buddy, you have the method="post" in the form, but what is this action?

  • Sorry Gabriel, I didn’t realize I had the method. But this "action" informs the page that you will receive the form data.

  • Action is the destination to which the form should point, in your case in the second option it is sending to "/Protocololatam/Insert", already in what you built, missed to direct the post somewhere declaring the action... soon it will try to post to its own route

  • Well, this "Protocololatam/Insert" is sent via an ajax request, via get

  • How can I upload

  • Well, then the question is not about c# or Asp.Net but about javascript

  • What do you mean? The file has to be sent via javascript tb?

  • Have a look here https://answall.com//questions/9704/upload-to-archive-with-ajax

  • Would work with get or just post?

Show 6 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.