user6619631
user6619631

Reputation:

How to upload image in wordpress?

I am new in wordpress, I am currently creating a plugin which is get the message and image and store it in database. I learn wpdb class to store data to database, But i still can't know how to move and upload file and store in also in folder and media library. Please help me i tried codes which i get at wordpress.org but still cant upload image to media library. If you cant tell me please reference to learn admin-ajax.

Upvotes: 0

Views: 86

Answers (1)

Abhishek T.
Abhishek T.

Reputation: 1133

Get an array containing the current upload directory’s path and url.

wp_upload_dir( string $time = null, bool $create_dir = true, bool $refresh_cache = false )

You can find more on https://developer.wordpress.org/reference/functions/wp_upload_dir/

Upvotes: 1

Related Questions