0

I have some images in local folder. I want to grab those images and send them to certain action of the controller without user interactivity. So I do not have to use file up loader to upload files one by one.

I don't know how to automate this task.

I have seen this but its using automation tool.

View Code:

@using (Html.BeginForm("AddDriverOffence", null, FormMethod.Post, new
{ 
enctype = "multipart/form-data", 
@data_ajax = "false",
id = "ImgForm",
name = "ImgForm",
target = "UploadTarget",
role = "form"
}))
{

   <div class="form-group">
        @Html.LabelFor(model => model.File, new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.TextBoxFor(model => model.File, new { type = "file"})
            @Html.ValidationMessageFor(model => model.File)
            <input type="submit" id="upload" name="upload" value="Upload" class="cancel" />
        </div>
    </div>
}

Controller:

private string AddDriverOffence(HttpPostedFileBase file)
{
 // I want to grab image here
}
2
  • Nice try, NSA. Can you imagine why it would be a bad idea for random web applications to be able to silently upload arbitrary files?
    – CodeCaster
    Nov 16, 2014 at 13:24
  • It will destroy user privacy. Nov 17, 2014 at 6:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.