CodeIgniter Forums
Using the FTP class to upload files from an upload form? can you do it? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Using the FTP class to upload files from an upload form? can you do it? (/thread-7214.html)



Using the FTP class to upload files from an upload form? can you do it? - El Forum - 03-30-2008

[eluser]Leggy[/eluser]
I was just wondering, to make my image host more expandable I was thinking I could use the ftp class to upload files to the other server. But reading through the documentation it looks more like I have to upload the files then move the to another server and then delete the uploaded file on the current server.

What would you suggest?


Using the FTP class to upload files from an upload form? can you do it? - El Forum - 03-30-2008

[eluser]Jamie Rumbelow[/eluser]
If you take the variable that has the file path from the $_POST array that passes on the form stuff, then you should be able to do it with the usualy upload() method.

Just use the form helper instead of the upload library to process the form.


Using the FTP class to upload files from an upload form? can you do it? - El Forum - 03-30-2008

[eluser]Seppo[/eluser]
Well... you should be able to move the temp file and you don't have to delete it...

Code:
$this->ftp->upload($_FILES['userfile']['tmp_name'], '/public_html/uploads/' . basename($_FILES['userfile']['name']));