Implementing your own upload form like this can be a major security vulnerability, you might want to instead use a library/script where such potential issues are already dealt with properly.
Here is one I remember using successfully on a project for a similar purpose (user uploaded video)… though it may be more than what you need, it does have more examples and documentation than a simplified web example:
PL Upload
EDIT: I just remembered that was actually my fallback uploader for that project, the main one used was ResumeableJS as it supports file resuming for large files (very handy for video uploads!)
Related Posts:
- add_filter the_content str_replace after shortcode
- Custom image upload
- My form action url is being prepended with a directory that does not exists
- How to store data from multiple forms using ajax and php
- Why Won’t My Inputs in a form with a Get method work together?
- Input data from email form not going to JSON file
- How to get the value of input hidden html from text editor to custom page template?
- Login to wordpress by clicking a link and specifying usernaname and password in url
- Search WordPress using static html page
- How to execute html code inside php?
- How to add post meta in while loop?
- File Uploader – Upload without adding to Media Library
- Adding attribute to the post.php form tag in wp-admin
- Front end file upload returning wrong attachment url
- WordPressUser Submission Form
- Custom forms with HTML
- Cascading dropdown select search based on Parent Page & Child Page
- HTML Form Question
- wordpress form action page not found
- Custom HTML form using PHP – help with ajax/username validation
- Correct Syntax for uploading files to custom directory in WordPress
- How to change upload directory in wp_handle_upload
- start_lvl Ignored in Custom walker_nav_menu
- Decrease file size upload in Media
- What exactly does “Posts page” do in WordPress?
- How to insert PHP code in a WordPress Post
- Adding a search form inside a div
- Debugging upload problem: What part of WP does actual image-resizing?
- Load custom field value into div with AJAX
- Creating wordpress user registration form
- Blank on static home page?
- Accessing a random image via ajax
- How to use a frontend URL with a Plugin
- submit the form to same page
- How to display blog images using wordpress in existing project
- How to display a value from a radio button in the options menu in wordpress
- How to display recent posts on home page with custom HTML
- Ajax form submit within a Post Metabox
- is it possible to force wordpress to always save thumbnails as ‘jpg’ not ‘png’
- WordPress automatically adds tags when pasting code, how to stop it?
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- Slide in Panel WordPress Post
- Using file_get_contents with Gravity Forms uploads folder to create images in the media library returning false
- HTML tags in bloginfo description
- Transferring working local PHP site to wordpress – with database (MySQL)
- Where in PHP do I move title and meta (date) to bottom of each blog section?
- Custom profile field with birthday. Troubles with
- Using the echo command adds unwanted br tags to source
- Post + form + action + results on the same page
- Commenting out unwated CSS/scripts in HTML with PHP
- How to show a ‘correct’ message after submit a form?
- “operation successful” message
- Path for php file for inserting data through html form
- Widget back end radio button issue
- Add shortcode in my div
- WordPress shortcode returns the data before
- Form Submission Not Working In Custom Theme
- Illegal string offset error in wordpress theme options textarea
- WordPress İmages Upload & Delete Error
- Allow user to Upload image and manipulate it on the frontend
- Pass important values server-side when processing form
- Is it possible to isolate and use WordPress functions outside of wordpress
- Testing a Form’s Zipcode Field with Regular Expressions to Determine WordPress Page Behaviour
- I can’t set image ad fatured programatically
- How can I update WordPress plugins or WordPress itself in all server?
- Search bar for wp menu
- Executing php on button press
- I want it to detect the duplicate comment and give a warning on the same page
- Trying to generate a CSS file in wordpress uploads folder
- WP Website is shown in HTML
- Mysterious letters appearing at the top of a few pages
- Current WordPress Page Title as Search Parameter into A Tag
- If user has clicked link add class and store using PHP/WordPress
- Implement jQuery Smart wizard
- Maximum file Upload
- How to Protect a private folder inside uploads folder, if User is not Logged In?
- How to center all text body in single.php at once?
- sessionStorage saves input value in browser but it is not loaded in the form field
- Changable favicon
- Right path for renaming a file in uploads folder
- AMP version of e-commerce without plugin
- Use PHP to inject HTML into before page renders?
- How to make a parent page for author.php?
- Multisite – Display different header content based on which site is accessed
- WordPress file upload
- html to posts, jpg to featured image, zip file contains jpg and html
- How do you change the tag font size in the repeater-template.php [closed]
- PHP tag in post content makes wordpress go crazy
- How to only fetch certain Tag ID’s
- Where to find the html for WordPress site? [closed]
- RegExp to EXCLUDE strip HTML (FOR SOMME) comments
- Pagination for div’s
- 403 (Forbidden) delete file image in themer folder
- How Can I Center the Logo in the Navigation Menu? [closed]
- Using Nonce for my Form
- How to pass username into form that sends data to database
- HTML in PHP problem [closed]
- Add multiple HTML attributes to an Elementor button
- Upload multiple files via ajax from an HTML file input
- get_post_meta returns on side but it doesn’t return on bottom of admin page