🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

PHP only download file not html for my c++ app

Started by
4 comments, last by fastcall22 3 years, 7 months ago

Hi

I want a php file to refuse download of a file it it was downloaded before. Now I understand the php coding but not how to send only the file (text without file extension). Downloader is my c++ app. PHP always wants to make html, how to avoid this?

Many thanks

Advertisement

i think you are in the wrong forum for this;

have u tried this?: https://www.php-forum.com/phpforum/

they looove php questions there, specially on tuesdays ?

have fun ?

PHP always wants to make html, how to avoid this?

Please explain.

If navigating to `http://localhost/path/to/file.php` serves the contents of the PHP file, then you must configure your webserver to execute PHP. The details depend on your environment, deployment setup, and web server software.

If navigating to `http://localhost/path/to/file.php` executes the PHP file, but shows the contents of the text-without-file-extension file, then the PHP script must instruct the browser how it should process the response using the `Content-Type` and `Content-Disposition` HTTP headers.

I want a php file to refuse download of a file it it was downloaded before

How do you define "it was downloaded before"? Downloaded by anybody once? Simply move the file after serving its contents. Download once per authenticated user? Set up persistent storage to track who downloaded what and when.

Ah yes my C++ app is not a browser, hence I would need such in c++? Downloaded by idaddress <10 →not allow (mariaDB). My C++ app is crossplatform (win/mac/linux), hence I don't want proprietary dependencies (and need to statically link).

MikeCyber said:
my C++ app is not a browser, hence I would need such in c++?

Quick HTTP overview, if you want to do it yourself. Otherwise, libcurl is the de facto library to use.

This topic is closed to new replies.

Advertisement