harishanchu / Laravel-FTP

A simple Laravel 4/5/6/7 ftp service provider with basic ftp methods.
220 stars 87 forks source link

Feature: overriding download mode #28

Closed hm122 closed 9 years ago

hm122 commented 9 years ago

Hi!

With Ubuntu Server I'm getting an error for downloading files in ascii mode (550 SIZE). It would be awesome to be able to override the mode with the download function, e.g. something like this:

public function downloadFile($fileFrom, $fileTo, $mode=null)
    {
        $fileInfos = explode('.', $fileFrom);
        $extension = end($fileInfos);
        if($mode == null) {
           $mode = $this->findTransferModeForExtension($extension);
       }
        try {
            if (ftp_get($this->connectionId, $fileTo, $fileFrom, $mode, 0))
                return true;
            else
                return false;
        } catch(\Exception $e) {
            return false;
        }
    }