• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Remote file exists - with a little twist

Participant ,
Jul 27, 2006 Jul 27, 2006

Copy link to clipboard

Copied

I need to know if a wmv file exists on a windows media server before I try to stream it. I don't think I can use cfftp because the file is located in the WMRoot folder, not the ftproot folder which cfftp queries.

I've tried cfhttp, but it doesnt work. I get the same result whether the file is there or not.
<cfhttp method="get" url="blah-blah"></cfhttp>
<cfoutput>#cfhttp.FileContent#</cfoutput>

Any help would be greatly appreciated.
TOPICS
Advanced techniques

Views

684

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 28, 2006 Jul 28, 2006

Copy link to clipboard

Copied

cftry/cfcatch

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 28, 2006 Jul 28, 2006

Copy link to clipboard

Copied

Thanks Dan, but I'm getting the same result. No error on either. Results are below, the .wav file does not exists, while the wmv file does.

Code (added user and pass just in case):
<cftry>
<cfhttp method="get" url="65.61.124.134/SXM/121_Alonna--James/vcard.wav" username="#video_user#" password="#video_pass#"></cfhttp>
<cfoutput>#cfhttp.FileContent#</cfoutput>
<cfcatch type="any">
Error
</cfcatch>
</cftry>
<br />
<cftry>
<cfhttp method="get" url="65.61.124.134/SXM/121_Alonna--James/vcard.wmv" username="#video_user#" password="#video_pass#"></cfhttp>
<cfoutput>#cfhttp.FileContent#</cfoutput>
<cfcatch type="any">
Error
</cfcatch>
</cftry>

Results:
[Reference] Ref1=http://65.61.124.134/SXM/121_Alonna--James/vcard.wav?MSWMExt=.asf Ref2=http://65.61.124.134:80/SXM/121_Alonna--James/vcard.wav?MSWMExt=.asf
[Reference] Ref1=http://65.61.124.134/SXM/121_Alonna--James/vcard.wmv?MSWMExt=.asf Ref2=http://65.61.124.134:80/SXM/121_Alonna--James/vcard.wmv?MSWMExt=.asf

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 28, 2006 Jul 28, 2006

Copy link to clipboard

Copied

<cfhttp> doesn't throw an exception on a failed request unless you tell it
to.

http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000272.htm

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 31, 2006 Jul 31, 2006

Copy link to clipboard

Copied

Ok, so I set throwonerror="yes", but guess what? I cannot throw an error if there is no error to throw. I've used cfdump and all returned data is the same. Nothing telling me if the file is there or not.

Maybe this is an impossible mission to accomplish with CF; so if it is, someone please let me know if I'm wasting time trying to do this.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 31, 2006 Jul 31, 2006

Copy link to clipboard

Copied

Respectfully, just because YOU can't get something to work, doesn't mean it's not possible to do in CF. That's a bit self-important, I think.

Now. If a file being requested from a webserver is not found, the webserver should issue a 404. If you tell <cfhttp> to throwonerror, then if a 404 is returned, it will raise an exception (I have - this minute - tested this). If the webserver is not returning a 404 for a missing file, there's something wrong with the webserver. If CF is now raising an exception and you ARE getting a 404 statuscode, that is very strange.

However you say the result of the CFHTTP is the same whether the file is there or not. This points to the webserver @ the other end not working properly. What statuscode ARE you getting back from the <cfhttp> request?

If you use a web browser to browse to the URL, what do you get?

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 07, 2006 Aug 07, 2006

Copy link to clipboard

Copied

Sorry about the delay.

Here are the two links. The later resides on a Windows Media Server.

65.61.124.134/SXM/121_Alonna--James/vcard.wav (file does not exists; Windows Media Player Error Code - C00D1197: Cannot play the file)
65.61.124.134/SXM/121_Alonna--James/vcard.wmv (file does exists)

To make it easier, I've cfdumped both sets of information at http://www.southernxposuremodels.com/vtest.cfm.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 08, 2006 Aug 08, 2006

Copy link to clipboard

Copied

> Sorry about the delay.

NP ;-)

> Here are the two links. The later resides on a Windows Media Server.

Well I dunno how Windows Media Server is supposed to work, but I tried
this:

<cfhttp URL=" http://65.61.124.134/nonsense_file.dat" method="get"
result="stFile3">

And it returned an HTTP status of 200. Odd.

You should perhaps read the docs on Windows Media Server adn see if there's
an explanation as to why it returns "200" for every request. And maybe
they'll also explain how to glean if the file actually DIDN'T exist.

Bottom line: this is not a problem with CF, it's a problem with how WMS is
responding to HTTP requests, or the way we'd EXPECT WMS to respond (ie:
with a 404 if the file doesn't actually exist).

--
Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 09, 2006 Aug 09, 2006

Copy link to clipboard

Copied

LATEST
Thanks Adam, I thought I might have been going crazy there for a lil while. I'll going to have to read up on the server to see if it can be forced to return a error.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation