megaupload.com Question on Effect
23-10-2005, 12:49
|
#1
|
|
Inactive
Join Date: Jan 2004
Location: Swansea
Posts: 1,376
|
megaupload.com Question on Effect
On http://www.megaupload.com they have a Feature I liked, but cant see HOW to do it
On this URL http://www.megaupload.com/?d=4KP1UGVA you wait 40 seconds then you can SAVE the File. I dont want that part... Next BIT I like....
1) There is a Button (like a Form Submit one)
2) Click the Button to SAVE File
3) When Pressed a POP-UP "Save Dialouge Box" opens
I dont want a Link & Save As Target, but a Button to LEFT Click & then it opens a Save Box..
Any ideas
|
|
|
23-10-2005, 12:52
|
#2
|
|
Inactive
Join Date: Jul 2004
Location: 127.0.0.1
Services: 50MB Virgin w/ TiVo 1TB
Posts: 1,255
|
Re: megaupload.com Question on Effect
Surely the save dialogue box is the same as left clicking it... Just megaupload do it automatically for you...
Personally megaupload gives me too slow speeds
__________________
Emancipate yourselves from mental slavery, none but ourselves can free our minds - Bob Marley
|
|
|
23-10-2005, 13:14
|
#3
|
|
-
Join Date: Jun 2003
Location: Somewhere
Services: Virgin for TV and Internet, BT for phone
Posts: 26,546
|
Re: megaupload.com Question on Effect
And has FAR to many popups..
|
|
|
23-10-2005, 13:26
|
#4
|
|
Inactive
Join Date: Jul 2003
Location: Poole, Dorset
Age: 41
Services: FreeSat+
Tivo
V-Box
VM 60MBit
Posts: 13,365
|
Re: megaupload.com Question on Effect
Its probably something to do with the Mime types on the server, theyve probably set it as something that doesnt display directly in your browser for everything and therefor it just straight downloads.
|
|
|
23-10-2005, 13:27
|
#5
|
|
Inactive
Join Date: Jan 2004
Location: Swansea
Posts: 1,376
|
Re: megaupload.com Question on Effect
If you "Left Click" a Link on a site it OPENS from Location... But on the site I linked has a Download Box & then when you LEFT click it, it opens a Save As box. Not open from Location...
Yeah slow & popups. But the Button I want (not adverts & slow) lol
---------
Is there a Script/Code to use that will re-create this effect without editing MIME types
|
|
|
23-10-2005, 13:43
|
#6
|
|
Inactive
Join Date: Jun 2003
Age: 45
Posts: 14,750
|
Re: megaupload.com Question on Effect
You would do it like this:
Code:
<script language="javascript">
function savefile() {
window.location="http://ww.site.com/files/file.ext";
}
</script>
<input type="button" value="Download this file..." name="savefile" onclick="savefile()">
|
|
|
23-10-2005, 13:52
|
#7
|
|
Inactive
Join Date: Jan 2004
Location: Swansea
Posts: 1,376
|
Re: megaupload.com Question on Effect
punky
I was so PLEASED... But it works with .zip (that works with Left Click Link anyway)
I want to save a AVI/MPEG via a Button if you can try a way to do it?
|
|
|
23-10-2005, 13:58
|
#8
|
|
Inactive
Join Date: Jun 2003
Age: 45
Posts: 14,750
|
Re: megaupload.com Question on Effect
Oh right you want to override a MIME type saved in a browser. You can't do that in Javascript, but you apparently can in PHP.
Here's an example.
http://forums.dreamincode.net/showtopic9446.htm
Follow that, and use the code I wrote above to open the .php file you create.
|
|
|
23-10-2005, 14:06
|
#9
|
|
Inactive
Join Date: Jan 2004
Location: Swansea
Posts: 1,376
|
Re: megaupload.com Question on Effect
Cheers Buddy...
To Re-Cap..
in .htaccess file
Code:
<Files mp3>
ForceType application/x-httpd-php
</Files>
Then... (edit /path/to/mp3/files/ to Folder Path)
Code:
<?php
$uri = explode("/",$_SERVER['PATH_INFO']);
$path = "/path/to/mp3/files/"; //path without any filenames!!! Must have trailing backslash
header("Content-Description: File Transfer");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=".basename($path.$uri[1]));
@readfile($path.$uri[1]);
?>
& add this to the same Page...
Code:
<script language="javascript">
function savefile() {window.location=http://ww.site.com/files/file.ext;}
</script>
<input type="button" value="Download this file..." name="savefile" onclick="savefile()">
Is that correct?
|
|
|
23-10-2005, 14:35
|
#10
|
|
Inactive
Join Date: Jun 2003
Age: 45
Posts: 14,750
|
Re: megaupload.com Question on Effect
Actually, that example doesn't look totally clear.
Here is a clearer example, from the PHP docs, so its more trustworthy.
PHP Code:
$filename = 'dummy.zip';
$filename = realpath($filename);
$file_extension = strtolower(substr(strrchr($filename,"."),1));
switch ($file_extension) {
case "pdf": $ctype="application/pdf"; break;
case "exe": $ctype="application/octet-stream"; break;
case "zip": $ctype="application/zip"; break;
case "doc": $ctype="application/msword"; break;
case "xls": $ctype="application/vnd.ms-excel"; break;
case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpe": case "jpeg":
case "jpg": $ctype="image/jpg"; break;
default: $ctype="application/force-download";
}
if (!file_exists($filename)) {
die("NO FILE HERE");
}
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: $ctype");
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".@filesize($filename));
set_time_limit(0);
@readfile("$filename") or die("File not found.")
save that in a php file. Alter the $filename bit for your file, and then do window.location="http://www.site.com/yournewphpfile.php"
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 21:20.
|