CodeIgniter Forums
FTP class issues - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: FTP class issues (/showthread.php?tid=52789)



FTP class issues - El Forum - 06-26-2012

[eluser]sehummel[/eluser]
I am trying to use the FTP class to upload a file from my Mac. I have tried this code:

Code:
$this->CI->ftp->upload('/Volumes/Users/universal/Desktop/' . $file, '/public_html/downloads/service-ftp/' . $folder . '/' . $file, 'ascii', 0775);

$file and $folder both have the right values in my code. I read a post from Phil Sturgeon that you cannot upload a file from a local computer to the server. Is that true? If so, then what is the point in the FTP class?

I want to create a way for my users to upload files from their computers and want more flexibility than the file upload class gives. The FTP class does, but only if you can upload from a local computer.

One of my issues is getting the local path of the file. $_FILES does not give you a path, just a file name and tmp_name.


FTP class issues - El Forum - 06-26-2012

[eluser]skunkbad[/eluser]
What errors are you getting?


FTP class issues - El Forum - 06-27-2012

[eluser]sehummel[/eluser]
I figured it out. What you need to do is this:

Code:
public function upload($file, $folder) {
  $this->CI->ftp->upload($_FILES['file']['tmp_name'], '/public_html/rest/of/path/' . $_FILES['file']['name'], 'ascii', 0775);
}