|
Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
Why is the FileExplorer control returning the selected file path including the website name. Ex: IIS web site: http://localhost/mywebsite IF I select a file from a location in localhost/mywebserver/myvirtualfolder/pictures, the getSelectedFile() function returns /mywebserver/myvirtualfolder/pictures/picture.jpg as the file selected. Now if I try to open the file in a different place I'm using : x = Server.MapPath('~/mywebserver/myvirtualfolder/pictures/picture.jpg)
but x i returning :
localhost/mywebserver/mywebserver/myvirtualfolder/pictures/picture.jpg
As you can see it, the path has 2 times mywebserve in the path.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
The file explorer returns:
/mywebserver/myvirtualfolder/pictures/picture.jpg
But you call MapPath with:
~/mywebserver/myvirtualfolder/pictures/picture.jpg
You should not add "~". Just call MapPath with whatever FileExplorer gives to you and you should have the correct full physical path.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
Thanks for your reply. It works now. The thing was that I'm trying to make it work on development environment (.NET WebServer) and production (IIS) environment. Looks like it's not possible. My other question is also why when the FileExplorer shows the first time all the files have a checkbox on the front and if I press the refresh button on the fileexplorer control, after refresh, the files don't have the checkbox. I want to stop the checkbox to appear all the time.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, MapPath does work on both your development server and production server. So I am not sure why you concluded it's not possible. You take whatever FileExplorer gives to you and pass it MapPath. It's as simple as that and it works regardless where you are running your code. I am not sure about the check box issues though. Our sample code works fine: http://demo.essentialobjects.com/Demos/File%20Explorer/Features/All%20Features/Demo.aspxYou can compare your code with our sample code and see if you can find out what you did differently. If you want to remove the checkbox, you should remove the first column the Grid. You can try this in a separate test page or in our demo page first. There is no reason for it to automatically show up once you remove it. Thanks!
|
|
Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
In IIS FileExplorer returns:
/mywebserver/myvirtualfolder/pictures/picture.jpg
In Development returns:
/myvirtualfolder/pictures/picture.jpg
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
I am not sure how we can explain this better. We have already explained this to you before in a separate post.
Just pass whatever FileExplorer returns to MapPath and that will be all is needed. You are doing extra work that over complicate things.
The point is FileExplorer always returns you a path that you can directly pass to MapPath. In a way FileExplorer and MapPath work together to always give you the correct physical path. You keep taking something in the middle and claims that they are different. Of course they are different because the setup are different. Since the setup is different, FileExplorer automatically acts differently to give you a different value so that in the end you will always be able to use the same code to get the physical path.
This issue is now closed.
Thanks
|
|