Hope all is well. I tried implementing this with a CSV file instead but when the csv is downloaded, the HTML code is also printed. Anyone knows how to resolve this?
A doubt,its work,without downloading image,i've tried downloading the php program file,but after downloading the notepad file, after i open, show a my wrote html file also, how to do it
Thanks before for your video , but any little error after download file , as shown the file its can't be open with message : error format. and I have solutions for this , and bellow its my code and really working fine : $filename = basename($_GET['path']); $filepath = './assets/file/berkas/' .$filename; if(!empty($filename) && file_exists($filepath)) { //Definisikan Header header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.$filename); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($filepath)); ob_clean(); flush(); readfile($filepath); exit; } I think the root cause problem is need to input header('content-length') because the size of file become increase if without that. Thank you.
Try this for additional reference WebApp - Login Form for Download Files ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-rkZj-Sk-XzQ.html ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-2nyYtanYC4Y.html
Thank you 🕺, but how do I set the content disposition if my file name contains special characters like &, + because I can’t download them though other files I’m able to. I would appreciate if you could help. Thank you 🙏
Very good tutorial, but the files that can be downloaded are only photos. document files such as (.pdf) and also compressed files such as (.rar) cannot be downloaded. can you tell me how to download (.rar) and (.pdf) files using php?
Yes i have made tutorials on file management you can check.. they are old.. if other than that u want any specific topic tutorial than u can comment here or mail me. Thanks❤️
ah yess im already downloaded your tutorials about file managemet, can I ask, ,about sending files through gmal , because my thesis is about files management
Hi from my other account. My answer. No it does not give any error... I explain the situation below I have 2 files namely index.php and downloadexcel.php. In index.php i have a button which sends the session information to downloadexcel.php. The downloadexcel.php file gets the data from sql table and inserts into the excel file.. The code runs perfectly fine in Chrome, Firefox and IE. But does not run in Opera. When i Launch Opera And Click On the download button it downloads the file but this works only one time in Opera. When i click on the download button again it does not download the excel file this time. When i restart opera it works again but for one time only. The headers i used in the downloadexcel.php file are as follows. header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') n header ('Content-Disposition: attachement;filename="name.xlsx"');
@@CodeFlix12 what would i need to do to run it on Opera. As this is my project for a collage course which requires the project code to be compatible with all the main stream browsers. Do i need to Change or Add A header?
This is a very helpful video. Can you please also help me do a tutorial "after the users key in their id (eg 001), users can download the files that I uploaded in the database according to the id" Thank you very much in advnace! :)
in this case, what I mean by ID is just a unique number for them to get their own files ( I want my customers to download their files themselves instead of email to them) :D
@@CodeFlix12 yes correctly uploaded, with proper permission. But the problem is when i click download button, instead of downloading this file it's open in binary format.
What not do do 101. WARING!!! excellent to download any file, I mean any system file!!! never trust user input, and make sure you just don't allow url params to decide full path of the file...
@@CodeFlix12 You just need to point those things out very clearly as most "new" people just copy code without realising it or just add comments inside code when showing example
in ur video u mentioned image1.jpg ........ but what if I used a form and I wrote my name and thats the name of the jpg which immediately created in the folder....I mean to say u dont know when u r writing the code that whats the name of the jpg will be....... in that case what should I write in the blank space??? click here