blenderNetworkpatreonblender-logosdheartuserthtimesbookphotopencilmap-markerchevron-rightbancommentcommentstwitterfacebookrsschainnavicongoogle-plusenvelopelinkedinmail-replycalendar-otumblrredditstumbleuponshare-altbloggerflattrflag

Making download links.

Making download links.

Postby themitchel0 » January 26th, 2011, 6:21 pm

hello again! does anyone know how to make a download link, that will only start the download if the persons logged in, i think i know about the second one, so never mind that, but making download links, im stuck on. anyhelp would be nice! thanks
themitchel0
Pro
Pro
 
Posts: 365
Joined: June 15th, 2010, 8:31 am

Re: Making download links.

Postby IrascibleOne » January 26th, 2011, 6:37 pm

A download link is essentially the same as any other link, only that the link points to the file that is to be downloaded. For example:

Code: Select all
<a href="example.pdf">Download Me!</a>

<a href="example2.zip">Download Me Too!</a>


You can't force the "Save As" dialogue to pop up though, as the browser is in control of what is done with the file. Typically, if the browser can't open the file itself or doesn't know what it is, the "Save As" dialogue is shown.
Image
User avatar
IrascibleOne
Site Admin
Site Admin
 
Posts: 1539
Joined: July 31st, 2008, 7:14 pm

Re: Making download links.

Postby themitchel0 » January 27th, 2011, 12:47 pm

hmm, i cant seem to get that to work, the file is a mp3 file, and it just gets put into an audio player online. thanks though
themitchel0
Pro
Pro
 
Posts: 365
Joined: June 15th, 2010, 8:31 am

Re: Making download links.

Postby SPARTAN-001 » January 27th, 2011, 1:17 pm

That's just the way your browser handles mp3 links.
//SPARTAN
Image
Practice makes perfect and nothing is perfect, so why practice? -brektzar
User avatar
SPARTAN-001
Legend
Legend
 
Posts: 1106
Joined: November 5th, 2008, 4:23 pm

Re: Making download links.

Postby djm » January 27th, 2011, 1:19 pm

to download audio by using the
Code: Select all
 <a href="song.mp3">Download me!</a>
tag you got to add the tag as an external link and RIGHT-click on it, choose "Save As.." and then select the folder as well as name for it. Simple as that. If you want to listen to it online, not embedded, then simply LEFT-click (normal mouse click) the link and enjoy the song. If you want to embed it, just add embed tags.
Regards, DJM aka Sheldin!

DeviantArt Profile
http://sheldiner.deviantart.com/

Youtube (Tutorials/Gaming)
http://www.youtube.com/SheldinLP
User avatar
djm
Pro
Pro
 
Posts: 478
Joined: December 11th, 2009, 4:04 pm
Location: Sweden

Re: Making download links.

Postby themitchel0 » February 11th, 2011, 3:35 pm

hmm, does any one know how to do this in jquery, i have a countdown timer that redirects to a page, and when that page is accessed, i would like a download to start without user interference, so it would act like a download from say source forge, any help would be nice!
themitchel0
Pro
Pro
 
Posts: 365
Joined: June 15th, 2010, 8:31 am

Re: Making download links.

Postby IrascibleOne » February 11th, 2011, 11:20 pm

You could use something like first answer here. Rather than using the click code, you can just throw this part in there when the page is finished loading:

Code: Select all
e.preventDefault();
window.location.href = 'upload/file.doc';
Image
User avatar
IrascibleOne
Site Admin
Site Admin
 
Posts: 1539
Joined: July 31st, 2008, 7:14 pm

Re: Making download links.

Postby themitchel0 » February 12th, 2011, 7:47 am

thank you so much!!!!! but now how would i say to only do something once?
themitchel0
Pro
Pro
 
Posts: 365
Joined: June 15th, 2010, 8:31 am

Re: Making download links.

Postby IrascibleOne » February 12th, 2011, 6:52 pm

I'm not sure I understand what you mean. You mean to only have that download link code be called once?
Image
User avatar
IrascibleOne
Site Admin
Site Admin
 
Posts: 1539
Joined: July 31st, 2008, 7:14 pm

Re: Making download links.

Postby themitchel0 » February 12th, 2011, 7:34 pm

yes, for some reason my code downloads the file every like 1 second, so i end up with like 100:P but any way heres my code
Code: Select all
 = 10;
      var url = "downloads\episode 1.zip";
      var d = 0;
      
      function countdown() {
         setTimeout(countdown, 1000);
         $('#box').html("Download Starting in " + number + " seconds");
         number --;
            
            if (number<0) {
               window.location.href = 'Downloads/Episode 2.zip';
               number = 0;
            }

         }
         countdown();
   });

thanks!
themitchel0
Pro
Pro
 
Posts: 365
Joined: June 15th, 2010, 8:31 am
Next
Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest