Jump to content

download issues


droidus

Recommended Posts

i am trying to let users download images, but it seems to only be working for only a png image.  i've tried .txt, word, and mp3.  here is my code for getting the path of the file:

 

// get full file path (including subfolders)

$file_path = $fileName;

find_file(BASE_DIR, $fname, $file_path);

if (!is_file($file_path)) {

  die("File does not exist. Make sure you specified correct file name.");

}

 

these other files that i am getting, are in the same folder as the image.  the error that i am getting, is "File does not exist. Make sure you specified correct file name."

 

here are the allowed extensions of the files:

 

$allowed_ext = array (

  // archives
  'zip' => 'application/zip',

  // documents
  'pdf' => 'application/pdf',
  'doc' => 'application/msword',
  'xls' => 'application/vnd.ms-excel',
  'ppt' => 'application/vnd.ms-powerpoint',
  
  // executables
  'exe' => 'application/octet-stream',

  // images
  'gif' => 'image/gif',
  'png' => 'image/png',
  'jpg' => 'image/jpeg',
  'jpeg' => 'image/jpeg',

  // audio
  'mp3' => 'audio/mpeg',
  'wav' => 'audio/x-wav',

  // video
  'mpeg' => 'video/mpeg',
  'mpg' => 'video/mpeg',
  'mpe' => 'video/mpeg',
  'mov' => 'video/quicktime',
  'avi' => 'video/x-msvideo'
);

Link to comment
https://forums.phpfreaks.com/topic/245600-download-issues/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.