Jump to content

PHP SFTP upload with Phpseclib


Portlandian

Recommended Posts

So I'm pretty new to coding, and I've mostly worked with .NET and C#, but I php seems simple enough.
 
I'm trying to help someone make an upload form for graphic files to their local sftp server. So, PHP web server allows someone to upload a file via sftp right to the graphic shop. Also, I need it to fire off an email stating that something has been uploaded, a small form to propagate said email (and maybe a log file), and some kind of visual cue to show the user what's happened.
 
So far, I've setup my environment as a LAMP VM server, put a dev copy of the website onto it, and the page in question is /upload/index.php 
 
I added the /NET/ folder from phpseclib to the upload folder, and now I think it's ready for code.
 

does anyone know of some good reference material for an uploader? I'm surprised I can't find a tutorial or premade package using phpseclib that is just an upload form. 

 

All help is greatly appreciated!

 

-Evan

Link to comment
https://forums.phpfreaks.com/topic/285323-php-sftp-upload-with-phpseclib/
Share on other sites

Well there's this:

 

http://phpseclib.sourceforge.net/sftp/examples.html#put

 

To create an upload form you can do something like $sftp->put($_FILES['filename']['name'], $_FILES['filename']['tmp_name'], NET_SFTP_LOCAL_FILE);

 

See http://www.w3schools.com/php/php_file_upload.asp . I wouldn't expect phpseclib's documentation to talk about how to do uploads with HTML anymore than I'd expect php.net to talk about CSS.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.