I made an improvement in my download system, instead of download each file, i change the code so i can download files with FTP and then asign them as download files.
I have seen it in UBERCART under DRUPEL system, but there this is much more better.
admin/controller/download.php - function insert() - about line 36
Code: Select all
/* comment this
if (is_uploaded_file($this->request->files['download']['tmp_name'])) {
$filename = $this->request->files['download']['name'] . '.' . md5(rand());
move_uploaded_file($this->request->files['download']['tmp_name'], DIR_DOWNLOAD . $filename);
if (file_exists(DIR_DOWNLOAD . $filename)) {
$data['download'] = $filename;
$data['mask'] = $this->request->files['download']['name'];
}
}
*/
// use this lines
if ($this->request->post['fileName']) {
$filename = $this->request->post['fileName'] . '.' . md5(rand());
rename(DIR_DOWNLOAD.$this->request->post['fileName'], DIR_DOWNLOAD . $filename);
if (file_exists(DIR_DOWNLOAD . $filename)) {
$data['download'] = $filename;
$data['mask'] = $this->request->post['fileName'];
}
}
Code: Select all
// add this line
$this->data['files'] = scandir(DIR_DOWNLOAD);
Code: Select all
<tr>
<td>First, download files to download directory.</td>
<td>
<select name="fileName">
<?php foreach ($files as $file) { ?>
<option value="<?php echo $file ?>"><?php echo $file ?></option>
<?php } ?>
</select>
</td>
<?php ?>
</tr>
Mo.