CodeIgniter Forums

Full Version: Using the FTP class to upload files from an upload form? can you do it?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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?

El Forum

[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.

El Forum

[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']));