Welcome Guest Search | Active Topics | Sign In | Register

FileExplorer returning website name with selected file Options
FPATER
Posted: Wednesday, April 8, 2009 2:13:34 PM
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.
eo_support
Posted: Wednesday, April 8, 2009 2:34:41 PM
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!
FPATER
Posted: Wednesday, April 8, 2009 2:52:10 PM
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.
eo_support
Posted: Wednesday, April 8, 2009 3:36:45 PM
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.aspx

You 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!
FPATER
Posted: Wednesday, April 8, 2009 3:40:34 PM
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
eo_support
Posted: Wednesday, April 8, 2009 3:55:59 PM
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


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.