kdeez
kdeez

Reputation: 711

"Open File" dialog default folder location

I have a razor file like this:

@{
    ViewBag.Title = "bid_import";

    using (Html.BeginForm("ImportBid", "Bid", FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
        <input type="file" name="file" value="" />
        <input type="submit" value="IMPORT BID" />
    }
}

that lets you upload a file.

This is in an MVC 4 web app.

All I want to do is have the "open file" dialog box default to a specific folder path/location. Google wasn't yielding good results. Hopefully someone here can help me out! Thanks in advance for the help, and let me know if I need to clarify.

CLARIFICATION: yes, this is a web application, but I only want to set the default folder location to help the other developers working on the app. So I can assume that they have the same folder paths/contents as I do.

Upvotes: 2

Views: 2516

Answers (2)

Hamid Pourjam
Hamid Pourjam

Reputation: 20754

You can not access client file system by Javascript because of security reasons. The browser will open the path which it decide it should open (usually last path). If you really want to do that you should use plugins such as Adobe Flash or Silverlight which gives the client to access the file system.

Upvotes: 3

MindingData
MindingData

Reputation: 12470

Usually by default the browser will show the last location that a user downloaded to. You cannot control this, think about it, how would you handle different operating systems even, let alone disk names/folder structures etc.

Upvotes: 0

Related Questions