Tim Johnstone
Tim Johnstone

Reputation: 363

Frustrating File Path Error

I'm having a bit of a problem with my file paths and I can't figure out what it is.

I'm developing a new website for a company - so I've hired out a URL with a hosting company to develop the site on. The problem is the file paths in the code on the company server pages are different to the ones on my hired server.

In the company server, within the root folder, there's 3 folders and in one of them (htdocs) lies the index.asp page and all the corresponding folders.

However, in my hired server's root folder it has the index.asp and all the corresponding folders - there's no 'htdocs' folder.

Now all the code is 100% correct - it's just the file paths that are stopping the site from working. My problem is getting a video to work correctly.

On the index page:

<div class="panel">
<a href="../artistVideo/recent.asp?clipid=105" class="lytebox" 
 data-title="" data-lyte-options="width:600 height:460 scrollbars:no">
...(some meta data)</a>
</div>

In 'clipid=105'.xml file (in 'artistVideo' folder):

<?xml version="1.0" encoding="utf-8"?>

<gallery>  

<album title="Blah Blah" description="More Blah">
<img src="../artistSoundClips/ARTIST/THE_MOVIE.flv"  
     title="Even more Blah" target="_parent"/>    
</album>
</gallery>

And in the recent.asp file, which holds a video object (in 'artistVideo' folder):

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/...." 
width="570" height="445" align="middle">
<param name="movie" value="../flash/recentwork.swf">
<param name="quality" value="high">
<param name="wmode" value="opaque">
<param name="allowFullScreen" value="true" />
<param name="FlashVars" value="xmlFilePath=<% Response.Write (videoid) %>.xml&xmlFileType=Default" />
<embed src="../flash/recentwork.swf" width="570" height="440" 
align="middle" allowFullScreen="true" 
FlashVars="xmlFilePath=<% Response.Write (videoid) %>.xml&xmlFileType=Default" 
quality="high" wmode="opaque" pluginspage="http://www.adobe.com/shockwave/download/download.cgi? P1_Prod_Version=ShockwaveFlash" 
type="application/x-shockwave-flash">
</embed>
</object>

So what is happening here is when the panel is clicked, the code looks to recent.asp which refers to the 105.xml file and outputs the video.

This code is taken from the asp pages on the company server and the code is all the same in the files on the hired server but like I said my file paths are wrong - when I take out the ../ on the index page and also the 105.xml page, I get the error message:

GET http://www.mydevelopersite.co.uk/flash/recentwork.swf 404 (Not Found) (recent.asp?clipid=105:1)

GET http://www.mydevelopersite.co.uk/flash/recentwork.swf 404 (Not Found) (recent.asp?clipid=105:1)

So to recap - on my server there's no 'htdocs' folder so all my files and folders are on a level up from that on the company server. And i've tried taking out the ../ from the:

<embed src="../flash/recentwork.swf" width="570"/>

It kicks out the error: GET http://www.mydevelopersite.co.uk/artistVideo/flash/recentwork.swf 404 (Not Found)

As stated, the code is 100% correct, there's no need to change it, it's just where the file paths are pointing to in relation to where the files and folders are on the hired server. PLEASE could somebody point out where I might be going wrong?!

Thank you!

Upvotes: 0

Views: 81

Answers (1)

IrishChieftain
IrishChieftain

Reputation: 15253

Use the tilda (~) operator in your control paths and add runat="Server" attribute.

ASP.NET Web Project Paths

For example, to correctly resolve an image path this way, you would change:

<img src="../Images/SampleImage.jpg" />

to:

<img src="~/Images/SampleImage.jpg" ID="myImage" runat="server" />

Upvotes: 1

Related Questions