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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.