mirceabondar Posted November 27, 2012 Share Posted November 27, 2012 (edited) Hy. How to allow customers to upload pdf file? I changed this code in images.inc.php but is not working.. function isPicture($file, $types = NULL) { // Filter on file extension $authorized_extensions = array('gif', 'jpg', 'jpeg', 'jpe', 'png', 'exe', 'pdf'); $name_explode = explode('.', $file['name']); if (count($name_explode) >= 2) { $current_extension = strtolower($name_explode[count($name_explode)-1]); if (!in_array($current_extension, $authorized_extensions)) return false; } else return true; /* Detect mime content type */ $mimeType = false; if (!$types) $types = array('image/gif', 'image/jpg', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png', 'application/x-pdf'); /* Try 4 different methods to determine the mime type */ if (function_exists('finfo_open')) { $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME; $finfo = finfo_open($const); $mimeType = finfo_file($finfo, $file['tmp_name']); finfo_close($finfo); } elseif (function_exists('mime_content_type')) $mimeType = mime_content_type($file['tmp_name']); elseif (function_exists('exec')) { $mimeType = trim(exec('file -b --mime-type '.escapeshellarg($file['tmp_name']))); if (!$mimeType) $mimeType = trim(exec('file --mime '.escapeshellarg($file['tmp_name']))); if (!$mimeType) $mimeType = trim(exec('file -bi '.escapeshellarg($file['tmp_name']))); } if (empty($mimeType) OR $mimeType == 'regular file' OR $mimeType == 'text/plain') $mimeType = $file['type']; /* For each allowed MIME type, we are looking for it inside the current MIME type */ foreach ($types AS $type) if (strstr($mimeType, $type)) return true; return false; } Edited November 27, 2012 by mirceabondar (see edit history) Link to comment Share on other sites More sharing options...
Kogkalidis Posted November 27, 2012 Share Posted November 27, 2012 Allow customers to upload pdf?? Why? Link to comment Share on other sites More sharing options...
mirceabondar Posted November 28, 2012 Author Share Posted November 28, 2012 (edited) Online shop offers products for printing, and customers need to send me random printing documents. (pdf, cdr, jpg..etc) Edited November 28, 2012 by mirceabondar (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted November 28, 2012 Share Posted November 28, 2012 if you're interested: we've got module for upload files / upload images to order by customers 1 Link to comment Share on other sites More sharing options...
DaYaasir Posted September 16, 2013 Share Posted September 16, 2013 @vekia What would be the largest file can be uploaded. Is there anyway to setup Maximum file size? Link to comment Share on other sites More sharing options...
vekia Posted September 16, 2013 Share Posted September 16, 2013 yes you can define maximum file size, everything depends on you i blocked upload of big file sizes, mainly because "test" server has got hdd space limitations 1 Link to comment Share on other sites More sharing options...
DaYaasir Posted September 16, 2013 Share Posted September 16, 2013 Thank you. It look awesome, i will get it today. Link to comment Share on other sites More sharing options...
vekia Posted September 16, 2013 Share Posted September 16, 2013 thank you, im really glad that you like it if you will have any additional questions - feel free to write Link to comment Share on other sites More sharing options...
elevationprint Posted December 15, 2014 Share Posted December 15, 2014 if you're interested: we've got module for upload files / upload images to order by customersIs this module still available? And is it free? Link to comment Share on other sites More sharing options...
Recommended Posts