$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>plugins - Overwrite a file with the content of a textarea|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

plugins - Overwrite a file with the content of a textarea

matteradmin9PV0评论

I’ve tried to solve my problem all day now and hopefully someone can help me here.

This is my goal: Beeing able to edit and save files located in the uploads directory (for example wp-content/uploads/myplugin/style.css).

I already managed to create a site with a textarea that contains the code from the style.css. I did it this way:

<textarea><?php include([dynamic_path_to_file]) ?></textarea>

This is working fine. I also managed to integrate the codemirror-editor which is looking and working really nice.

Now I want to save the file after editing its content.

How can I do that?

I already tried some AJAX-Functions, for example as it is explained here:

I was also thinking of something like putting it in a form and send it somewhere on submit but I did not manage to get any good result.

If you can help me with my problem you’d really make my day.

Thank you in advance, Oliver!

I’ve tried to solve my problem all day now and hopefully someone can help me here.

This is my goal: Beeing able to edit and save files located in the uploads directory (for example wp-content/uploads/myplugin/style.css).

I already managed to create a site with a textarea that contains the code from the style.css. I did it this way:

<textarea><?php include([dynamic_path_to_file]) ?></textarea>

This is working fine. I also managed to integrate the codemirror-editor which is looking and working really nice.

Now I want to save the file after editing its content.

How can I do that?

I already tried some AJAX-Functions, for example as it is explained here: https://stackoverflow/questions/9543224/how-to-sending-php-code-from-codemirror-editor-via-jquery-ajaxpost-and-using-p

I was also thinking of something like putting it in a form and send it somewhere on submit but I did not manage to get any good result.

If you can help me with my problem you’d really make my day.

Thank you in advance, Oliver!

Share Improve this question asked Oct 18, 2018 at 15:00 OliverOliver 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

I got answer to that question in the wordpress-support-forum: https://wordpress/support/topic/overwrite-a-file-with-the-context-of-a-textarea/

Post a comment

comment list (0)

  1. No comments so far