Wordpress Site Download Php File

Posted By admin On 02.02.20
Active5 years, 4 months ago

Trying to manage file downloads on your WordPress website? Here's a list of the top 13 WordPress download manager plugins to get you started. To force a file to download, the correct way is. Confused that you’re requesting a text file (PHP) but you’re sending compressed data with a different content.

I have a little problem with my download script in wordpress.On my website, you can upload some files in custom posts and some users, after login, can download them.I simplified, just for testing, the whole code by simply passing the ID of the custom post and dinamically getting the file to download.Here is the code:

Now the problem is:Downloaded file has correct name and correct size, but I just cannot view it.I tried with a simple jpeg and, using WinMerge, it seems like 3 lines have different values, but I can't find differences:ORIGINAL FILE: æ–çç©è2è¼éFéÐê[êåëpëûì†ííœî(î´ï@ïÌðXðåñrñÿòŒóó§ô4ôÂõPõÞömöû÷Šøø¨ù8ùÇúWúçûwüü˜ý)ýºþKþÜÿmÿÿdescDOWNLOADED FILE: æ–çç©è2è¼éFéÐê[êåëpëûì†ííœî(î´ï@ïÌðXðåñrñÿòŒóó§ô4ôÂõPõÞömöû÷Šøø¨ù8ùÇúWúçûwüü˜ý)ýºþKþÜÿmÿÿdesc

Here is a stamp of another line:http://cadienvan.altervista.org/stackoverflow.png

I really cannot see any difference!P.S. The Black line you see in the above image is just my cursor!

*I just found that in the row you can see in the image, in the upper one(So in the original file), there are 4 white spaces that have been canceled in the downloaded one.

Michael Di PriscoMichael Di Prisco

1 Answer

The content type of your file should be not generic application/octet-stream, but the type of the file itself, try changing this line:

to ($file_type is already defined in your code)

EDIT : Also make sure that you do not have any spaces or new lines in the source code (at the beginning of your script or at the end), because those may be included in the output.

EDIT : Try to remove all header(..) lines, except:

Content-Type, Content-Disposition and also add another one:

header('Content-length:' . $file_size);

bodi0bodi0
16.6k6 gold badges32 silver badges46 bronze badges
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

Not the answer you're looking for? Browse other questions tagged phpwordpressdownload or ask your own question.

Active1 year, 7 months ago

Is there a way to edit the index.php file in wordpress?

How to reset my canon pixma printer. Find the right driver for your Canon Pixma Printer. Download software for your Pixma printer and much more. Download drivers, software, firmware and manuals and get access to online technical support resources and troubleshooting. PIXMA Printers Support - Download drivers, software, manuals. New Products New Products. We offer Canon support for the suite of Canon products. From Canon printer drivers to Canon camera support and Canon printer Support we've got you covered. How can we help you today? Feedback; Drivers & Downloads. Find the EOS Utility Software version compatible with your camera Learn More > Wireless Help: Wireless installation. The software is compatible with Windows 10, 8.1, 8, 7, XP & Vista. The tool has been developed to scan for the outdated or missing Canon Printer drivers and download their up-to-date, compatible version. How can the answer be improved? We believe there are no limits to what an image can do. That's why we've used our history of imaging expertise to drive innovation across new industries, all with a single, clear vision: To help our customers see impossible.

Wordpress Site Download Php File

Around the web i found a lot of post saying to go to appearance -> editor,

but I can't find this menu.. maybe this feature was removed..

So how can I do it?

user3542686

2 Answers

Please do this.

Go to WordPress Installation directory.Follow the path wp-content >themes.Open your theme folder.In that you can see index.php file.Edit it and save.

Anoop AsokAnoop Asok

There are two ways you can edit your PHP files.

Php

Method 1: Edit the file in your Installation Directory on the Web Server(this is what Anoop Asok is talking about)

File Extension Php Wordpress

Go to WordPress Installation directory. Follow the path wp-content > themes. Open your theme folder. In that you can see index.php file. Edit it and save.

Method 2: Edit the file from the WP Dashboard(This is easier and is what you were trying to do but that file isn't always made available by your theme)

  • Download, install, and activate the Synchi plugin (this is an awesome IDE and one of its nice features is that it will allow you advanced theme editing)
  • Go to Appearance > Editor . Now you will see the -themes- window on the right and you will have full access to all your theme files.
  • Double-click your theme and drill down until you find your file you want to edit

NOTE! You should avoid editing your theme files because they might be over-written next time you update your theme. Make a child theme and put a copy of index.php in there and work off that one instead.

How To Download Php File From Website

Matt WilsonMatt Wilson