Hi All,
Nearly finished my Summer School Project but have a problem downloading from a webserver I'm using some code found within the Apps Academy on how to download html or a file. My code is:-
on mouseUp
put the selectedtext of field "Video List" into theVideoFileName
set the itemDel to "/"
ask file "Save file as:" with selectedtext of field "Video List"
if it is empty then exit mouseUp
put "http://webserver/folder/" & theVideoFileName into VideoUrl
put VideoURL into URL ("file:" & it)
end mouseUp
All the above does is download a 56bytes file named as I have requested but not the full file (Which is a .mov file)
Any ideas?, I have tried a binfile also, same result.
Problems downloading file from webserver
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Problems downloading file from webserver
Hi,
Here is a debug test:
Take the URL you get from the VideoUrl variable and paste into your browser, see what you get.
If you get the same 56 bytes then everything is working as it should. Now of course your URL maybe incorrect... That would be the place to start looking.
It sounds like you are getting a 404 error page (really small)
One thing to watch out for is spaces and special characters in the URL you may have to URLEncode the url before using it.
Simon
Here is a debug test:
Take the URL you get from the VideoUrl variable and paste into your browser, see what you get.
If you get the same 56 bytes then everything is working as it should. Now of course your URL maybe incorrect... That would be the place to start looking.
It sounds like you are getting a 404 error page (really small)
One thing to watch out for is spaces and special characters in the URL you may have to URLEncode the url before using it.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Problems downloading file from webserver
Thanks for the reply, I've checked the url as suggested when pasted into a browser the .jpg or .mov file displays or plays the file so it seems the url is correct. I have also checked for any spaces in the url. My code now looks like this:
on mouseUp
global playlistURL
put the selectedtext of field "Video List" into theVideoFileName
replace space with "%20" in theVideoFileName
set the itemDel to slash
ask file "Save file as:" with selectedtext of field "Video List"
put playlistURL & theVideoFileName into VideoUrl
put VideoURL into URL ("file:" & it)
end mouseUp
on mouseUp
global playlistURL
put the selectedtext of field "Video List" into theVideoFileName
replace space with "%20" in theVideoFileName
set the itemDel to slash
ask file "Save file as:" with selectedtext of field "Video List"
put playlistURL & theVideoFileName into VideoUrl
put VideoURL into URL ("file:" & it)
end mouseUp
Re: Problems downloading file from webserver
I have now fixed this also
I needed:-
put URL VideoURL into URL ("binfile:" & it)
This is now working.
I needed:-
put URL VideoURL into URL ("binfile:" & it)
This is now working.