Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

I am trying to upload a file to server and the problem is, I have to allow the user to select the file which is on a shared location.

Can i open the file dialog with a default location pointint to that URL where my files are present?

The system i am building is an interface.The first system puts the output file on share point.
In my system, user browses through share point and chooses relevant files and uploads.
Here i process the files and send the data to the next system.

Hope this is clear now.


Thanks,
Manognya.
Posted
Updated 1-Mar-13 6:20am
v2
Comments
Sandeep Mewara 1-Mar-13 10:00am    
I doubt that. File browse is client side and depends on client system browser setting.
Sergey Alexandrovich Kryukov 1-Mar-13 11:27am    
True. Actually, browsers of the files to be uploaded already remember where to look file, in more or less reasonable manner. It depends on the particular browser. A Web application should simply not touch it, and it cannot.

I answered in more detail, please see.
—SA
manognya kota 1-Mar-13 12:22pm    
Can we handle it using client script and see that it opens a folder structure in sharepoint?
bbirajdar 1-Mar-13 10:11am    
I agree with Sandeep... Its not possible..Provide the user with the links to the download.. Why do you need file open dialog?
Sergey Alexandrovich Kryukov 1-Mar-13 11:07am    
No, a file dialog is of course open, even if this is as simple as <input type="file">. When a user clicks on browse button (something like [...]), the dialog is shown.
OP only wants to change the default directory...
—SA

1 solution

Just to make it clear, because there is some confusion you can see from comment. Of course the dialog is shown even in the simplest form of upload:

HTML
<form method="post" ...>
    <!- ... ->
    <input type="file" name="img">
    <!- ... ->
</form>


In this, case, the name "img" will be used to retrieve the file from HTTP request on the server side.

If the user clicks in a small button, usually right from the input field, something like […], the browser dialog will be shown.

Basically, this is all you can do. But the problem of default directory not only unsolvable, it simply makes no sense. Not only you have no control over the client site; all you do is the Web application. It "does not know" anything about a client system. This time this is one, another second this is something else. What default? Just think a bit about it.

However, In fact it is possible to store last accessed directory on each client system. But interfering with the work of file browser could only be possible if this was a standard feature; only that way it could be possible to use on all platforms and browsers. But, to best of my knowledge, there is no such thing. And I would say, for a good reason. After all, the user is not an idiot; she or he is supposed to know where are the local files.

At the same time, it will happen anyway, without any of you efforts on some browsers, and won't happen on others. This is just the implementation detail of every particular browser.

—SA
 
Share this answer
 
Comments
manognya kota 1-Mar-13 12:28pm    
Thanks for the response.
The location should be defaulted because that's the root folder where the files that are valid are available.
I have a doubt.When a file dialog box opens, we have a option at the left pane to select from network places.
Here i can see some web folders which are not on the local machine.Can i create a web folder through code pointing to a sharepoint location?
Sergey Alexandrovich Kryukov 1-Mar-13 13:05pm    
This is all the matter of the user private stuff. A Web application has nothing to do with that, can you understand that? No, it hasn't be anything in particular. The user decides what to upload. All your questions are just irrelevant; they have nothing to do with your Web application in principle. If you don't like that, you have to use anything, but not the Web.
—SA
manognya kota 1-Mar-13 13:17pm    
ok.Thanks
Sergey Alexandrovich Kryukov 1-Mar-13 13:23pm    
Will you accept the answer formally then (green button)? This is all you can do anyway...
—SA
_Amy 2-Mar-13 0:49am    
Nicely Explained. Deserves +5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900