Could someone give me the code for downloading a file from my web site without using Active X Code. Thanks
Could someone give me the code for downloading a file from my web site without using Active X Code. Thanks
Depends on the file type. For example, if you make a .zip file it will prompt the visitor to download once they browse to the file name...
or you can try something like this (untested):
orrrrr... take a look here: http://elouai.com/force-download.phpCode:<? php function force_download($file) { $dir = "../log/exports/"; if ((isset($file))&&(file_exists($dir.$file))) { header("Content-type: application/force-download"); header('Content-Disposition: inline; filename="' . $dir.$file . '"'); header("Content-Transfer-Encoding: Binary"); header("Content-length: ".filesize($dir.$file)); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $file . '"'); readfile("$dir$file"); } else { echo "No file selected"; } //end if }//end function ?>
However, I don't think any of these methods are completely cross browser compatable.
{CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
Follow Me on Twitter: @InkingHubris
PHP Code:$result = mysql_query("SELECT finger FROM hand WHERE id=3");
echo $result;
And that, folks, is how not to comment code.Code:} //end if }//end function
The idea is to explain bits that might not make sense, not to point out the blatantly obvious and leave the rest undocumented.
roger38: How files are handled is entirely up to the user. The best you can do is stick it in a ZIP archive, but even that won't necessarily cause the effect you want, if the user has their browser set up otherwise.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Originally Posted by Twey
LOL I said untested, I didn't say I wrote it... You know I couldn't do that... yet... I am still on page 3 of the W3 school, LMAO!
{CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
Follow Me on Twitter: @InkingHubris
PHP Code:$result = mysql_query("SELECT finger FROM hand WHERE id=3");
echo $result;
Hahaha, fair enoughI said untested, I didn't say I wrote it![]()
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Bookmarks