How to automatically upload file after file has been chosen

后端 未结 4 1228
走了就别回头了
走了就别回头了 2021-01-18 20:25

I have the following code for uploading a file in my site:

@using (Html.BeginForm(\"UploadProfileImage\", \"Member\", FormMethod.Post, new { @encType = \"mul         


        
4条回答
  •  南方客
    南方客 (楼主)
    2021-01-18 21:18

    FileUpload does not support any kind of automatically upload a chosen file to the server. You will have to provide some kind of mechanism - see MSDN

    Saving Uploaded Files

    The FileUpload control does not automatically save a file to the server after the user selects the file to upload. You must explicitly provide a control or mechanism to allow the user to submit the specified file. For example, you can provide a button that the user clicks to upload the file. The code that you write to save the specified file should call the SaveAs method, which saves the contents of a file to a specified path on the server. Typically, the SaveAs method is called in an event-handling method for an event that raises a post back to the server. ...

提交回复
热议问题