![]() |
|
| |||||||
| Notices |
| BlueVoda - General Issues All BlueVoda support issues that are not covered in the below forums. |
![]() |
| | LinkBack | Thread Tools |
|
#1
| |||
| |||
|
I want to give the public an option to EITHER download an mp3 to their computers OR listen to it on site using the Windows Media Player. The problem is that when I click on the text link to download it to the computer, it automatically opens it in the Media Player..... If i create it as a .zip file, I am going to have to upload it twice (once as a zip and once as mp3 to listen to)..... If I right click the text link, that works, but it is not proffesional enough.....If a create the link as 'file://' instead of 'http://' , the link doesnt work... Is there a way that I can upload the file ONCE and have the option of a download OR real time listen? I am new so I dont have a site up and running yet, but my Client ID# is 18412 Thanx |
|
#2
| ||||
| ||||
|
You need a script for that: <?php $filename = $_GET['filename']; $filesize = $_GET['filesize']; $filetype = $_GET['filetype']; header("Pragma: public"); header('Expires: '.gmdate('D, d M Y H:i:s').' GMT'); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header("Content-type: Application/ $filetype"); header("Content-Disposition: attachment; filename=$filename"); header("Content-Description: Download PHP"); header("Content-Length: $filesize"); header("Content-Transfer-Encoding: binary"); readfile($filename); set_time_limit(0); ?> Copy the code, paste it in notepad, and Save As "download.php". Upload it in your site. Now, in your page create the Link for playing, as normally, and a second link, for download, as download.php?filename=realfilename&filesize=realfilesize&filetype=realfiletype realfilename and realfilesize and realfiletype MUST be the actual name, size and type of your file. Of course, this will only work when published, as it is in php
__________________ Navaldesign Logger Lite: Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA! |
|
#6
| ||||
| ||||
|
Most likely either the filesize isn't correct (make sure its in bytes, not kb or mb), or the filename of the file on your website isn't correct (although if its a problem with the filename it should give you an error)
__________________ Register/Login Script Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script |
|
#7
| ||||
| ||||
|
Sorry, it has been my mistake. I edited the third and fourth line as the ones i gave you are from a script of mine that retrieves the details from a database, which is not your case. Replace the entire code and try it again.
__________________ Navaldesign Logger Lite: Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA! |
|
#9
| ||||
| ||||
|
I edited directly the original post. The difference is in the third and fourth line. In your computer, browse the folder where your mp3 is. Right click on it, Properties, and it will display the file properties. Among them the size, which will be something like (as an example) 35897 bytes. This is the number you need to pass over to the script, not a rounded value. As for the file type, if your file is mp3, then that's the value that you need to pass to the script. So it would be: download.php?filename=testing.mp3&filesize=35897&filetype=mp3 Make SURE the file name contains no blanks (whitespaces)
__________________ Navaldesign Logger Lite: Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA! |
|
#10
| |||
| |||
|
I copied the text and checked the bytes: thsi is the real code: download.php?filename=anybody.mp3&filesize=37393&filetype=mp3 still not working? the test site is www.mcpbm.com thank you |
|
#11
| ||||
| ||||
|
I will back to you within 1 hr as i am busy now, and we will sort this out.
__________________ Navaldesign Logger Lite: Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA! |
|
#12
| |||
| |||
|
I think i found the problem, but I dont know how to solve it In the same folder as my mp3 file there is file called "error_log". In there the following message appears every time i try the link: [16-Oct-2007 08:48:59] PHP Warning: readfile() has been disabled for security reasons in //public_html/test/download.php on line 15 how do I stop this problem? Is it through my cpanel? Thanx |
|
#13
| ||||
| ||||
|
readfile should not be disabled. If it is, please submit a suppor ticket asking for it to be enabled. I believe VH staff can enable it in the php settings.
__________________ Navaldesign Logger Lite: Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA! |
|
#14
| |||
| |||
|
thank you very much for all your help VH inserted a file called "php.ini" into my public_html directory and it all works fine (a guy from the IT department said that if I replaced readfile() with include() it would also work but that it is more secure to stick to readfile()) thanks again Last edited by Jacho; 10-17-2007 at 11:27 AM. Reason: added a point of interest |
|
#15
| ||||
| ||||
|
Hi Jacho, no, include() will not work. You see include() embedds the file content in your script, whilst readfile() reads the content, and pushes it through the header command to the users browser.
__________________ Navaldesign Logger Lite: Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA! |
|
#17
| ||||
| ||||
|
The code is for ANY type of file. Make sure you have no mistakes.
__________________ Navaldesign Logger Lite: Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA! |
|
#19
| ||||
| ||||
|
Please create and provide a link to download a wav file. as a test
__________________ Navaldesign Logger Lite: Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA! |