简体   繁体   中英

How do I install nodejs as an asset upload web service to work with my wordpress setup

I have a Wordpress setup and my client needs users to upload large image and video files into the media library using a front-end form - NOT the wp backend.

I was thinking using something like express with a package like formidable

I want to know if it is possible to create an internal service on my vps server that wordpress could talk to.

Specifically, I want to know:

  1. How do I hit an external url like api.domain.com/uploads and send wordpress data through to that server

  2. How do I get the processed output back into wordpress and then save it

Here is an example on retrieving information from an external source through node.js & PHP

http://coenraets.org/blog/2012/10/creating-a-rest-api-using-node-js-express-and-mongodb/

With that said, I would personally create a shortcode by plugin design or create a theme template for this particular Form setup and with a combination of PHP, JS, Jquery, and various functions

if(is_page("page_name")) {
    /*custom functions that will connect externally*/
    wp_insert_comment($array_of_values);  //pass values through standard PHP methods (global variables, etc)
}

Reference:

https://codex.wordpress.org/Writing_a_Plugin

http://codex.wordpress.org/Shortcode_API

http://codex.wordpress.org/Function_Reference/is_page

http://codex.wordpress.org/Function_Reference/wp_insert_comment

http://codex.wordpress.org/The_Loop#Nested_Loops

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM