Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Downloading a file (in admin - for admin) to use elsewhere


Chadduck

Recommended Posts

I am haing difficulty with modifying an admin module to work within the 2.3.1 environment that works fine in a 2.2RC2a environment.

 

The module creates a file, stores the file, and when user presses the DL FILE button the file displays on the screen instead of being sent to the user. I have spent close to 24 hours researching this, on php sites, OSC sites, and here. It makes no sense since if the file is called direct by URL the browser says "where you wanna put it?"

 

The only modification done to the working 2.2RC2a mod was removal of the tab menu and making it into a "box" on the admin screen. EVERYTHING except the file download portion works. It writes to the db, reads the db, creates the necessary file in the correct format, the file imports to the user's final program correctly like I said it works CORRECTLY except the DL.

 

Code environment is Apache, PHP 5.3.2, and MySQL 5.1.41 - also the "admin/output" directory is 777.

 

HERE IS THE CODE BEING USED. I even inserted extra echo cmds to ensure that each step was seen. Each step was reached, at least the echo cmd was sent to the screen but still no DL only screen display.

 

// Download file

if (DL_FILE==1) {

/* ORIG */

$filename="output/orders.iif";

$size=filesize($filename);

header("Pragma: public");

header("Cache-Control: private");

header("Content-Type: Application/octet-stream");

header("Content-Disposition: attachment; filename=orders.iif");

header("Content-length: $size");

readfile($filename);

 

 

I have been stuck on this for 5 days... I have tried countless variations of code for this found on many different sites.

 

ANY and ALL suggestions would be helpful cause quite frankly I can not see WHY it is NOT working. (not to mention I am going bald from pulling out my hair LOL)

 

Thank you in advance,

 

BJ

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...