Questions tagged [uploads]

This include all question concerning the process of uploading file, whether from the WP Admin Pages or from a front end editor.

Filter by
Sorted by
Tagged with
0 votes
0 answers
5 views

Wordpress pointing animated GIF images with wrong file name upon upload (GIFs animation not working)

y’all! How are you doing?! I’ve been struggling with animated GIF images on my website for a while now, and I discovered the problem, but not the solution, still. When I upload an animated GIF as a ...
0 votes
0 answers
6 views

Upload the images folder with sub-folders directly to server

I have a News_images folder with a lot of subfolders in it. Each subfolder contains images for one post. I want to upload the whole News folder to the server then access the subfolders with WP Media ...
0 votes
1 answer
17 views

How to overwrite image if it already exists - Wordpress, Gravity form

How do I make the old file replaced when the user uploads a new one? Now the files are named a1.jpg, a2.jpg, a3.jpg. If the user uploads a.jpg, then I want to overwrite the a.jpg that already exists. ...
0 votes
1 answer
22 views

Many images in wp-content/uploads folder that are not in Media Library

I think my database must be out of sync, or something. I checked the wp-content/uploads folder in my Bluehost File Manager and I have many more folders and files than I see in the Media Libary. I also ...
  • 1
4 votes
2 answers
81 views
+50

How to use 'blogs.dir' as media upload instead of 'uploads' directory in WordPress multisite setup

Setup 1 : The general subdomain/custom-domain based multisite setup for child network sites has its upload directory like this /home/example1.com/public_html/wp-content/uploads/sites/8/2022/01/logo....
  • 186
1 vote
0 answers
18 views

How to connect WordPress media to another host?

I have uploaded about 1000 PDF files in the media section of the WordPress site, how can I transfer the files to another host and change the links of the files in the content of the site? the second ...
0 votes
0 answers
3 views

Inserting Media on New Post But Hides Previous Uploads for Editor/Contributor

We have a community website where people upload media. However, We wanted to restrict them to upload and attach previously uploaded media so that the previously uploaded media on different post are ...
0 votes
0 answers
46 views

if user role is x - show image - wordpress

I have set up a member portal with ultimate member where users can fill in and submit various forms and then see the answers in a list. Each submitted answer is automatically converted into a pdf. ...
0 votes
1 answer
27 views

Custom Theme functions.php – Using add_settings_field and input type="file" to set custom logo

I've seen several examples for "add custom logo" to wordpress theme, most of which use this basic code, specifically function display_logo_element() { ?> <input type="...
0 votes
1 answer
38 views

How to get Wordpress to resize images for srcset?

I've added a custom image size to my functions.php: add_image_size('banner', 1920, 300, true); I'm loading images in this custom size, using wp_get_attachment_image() to get a srcset. However ...
  • 3
0 votes
2 answers
20 views

Increased max_upload_filesize, but still can't upload plugin [closed]

I'm trying to upload a plugin (it's not available in the marketplace), that's 2.73 megabytes, but the limit is 2M. I've increased the max_upload_filesize variable in php.ini to 3M, but still can't ...
0 votes
0 answers
15 views

Upload to a specific media folder created by FileBird Lite

I have an import that runs in the background of my server through cron. I have a plugin called FileBird Lite (https://ninjateam.org/wordpress-media-library-folders/) that helps create folders and such ...
0 votes
1 answer
16 views

How do I restore attachment from files in wp-upload

I used the wordpress import tool to import a file and downloaded the attachments included. After a successful importation, I discovered that my media library only contains 3 file. After hours of ...
0 votes
0 answers
16 views

Updating Media Library PDF's in bulk

I've built a new site for my client that uses PDF's from the old site media library. He's redesigned all the pdf's and now has asked me to replace them on site. It should be noted that the old PDFs a ...
  • 101
0 votes
0 answers
18 views

Uploaded images not displaying full size preview or inserting into posts

Original issue I was having an issue where image uploads gave the error “could not insert attachment into the database.” PHP memory limit and other settings are fine Disk space is fine Ran check on ...
0 votes
0 answers
36 views

My subdirectory sites images (except webP) are throwing to 404 page even they are exist

As I explained in the title, the images on my main site are fine, but the images on my sub-directory sites are not showing. Except for the WebP type, oddly enough. They are visible. İmages can upload ...
  • 1
0 votes
0 answers
18 views

Auto shortlink for file uploads

Is it possible to create a shortlink automatically for files (PDF) that are uploaded to a specific folder? For example, there will be a series of downloadable PDF's with the following URL structure; ...
0 votes
1 answer
57 views

Uncaught Error: Call to undefined function file_is_valid_image()

This is the function doc. But when I ran the below I get Uncaught Error: Call to undefined function file_is_valid_image() $json_file = get_post_meta( $listing->ID, '_json_file', true ); $...
0 votes
1 answer
71 views

How to rename files during upload to a random string?

I want my files being renamed automatically on upload to a random number that does not interfere with other random named files. I am new to PHP and do not want to change a code snippet every year to ...
2 votes
1 answer
86 views

I want to disable certain file types from upload from dokan description field

I am using WooCommerce & dokan as multivendor plugin. Sadly, by default Dokan don’t have the option to add Media files in product description like in WooCommerce. It looks like this: I found a ...
0 votes
0 answers
17 views

I am facing problem in loading and downloading Mp3 files

I am facing problem in loading and downloading Mp3 files in my website ( ). Most of the content in the website is of Mp3 file. I am also using cloudflare and wp-rocket. Mp3 file is not fully playing ...
0 votes
0 answers
12 views

How can comments be turned off for media attachments on Wordpress?

I want comments always turned off for media attachments. I wrote the following codes to accomplish this. But this code is not working. I've also reviewed many similar topics: Resource-1, Resource-2, ...
1 vote
0 answers
21 views

Retroactively change Permalinks for media files after disabling year/month format

Disabling "Organize my uploads into month- and year-based folders" works as expected for new files uploaded. What I have not been able to find is if there is a way to also "move/...
0 votes
0 answers
26 views

Obtaining detailed error information from Media file upload process

We have an issue with uploading PDF files to websites we build that are created using Adobe Illustrator. The issue is a new thing (only the last couple of months). The error description is generic (&...
  • 1
0 votes
0 answers
23 views

Question regarding the file path for media_sideload_image and wp_upload_dir()

Just need some advice on uploading images. I am using ACF / oEmbed to display a video in my blog and in the process extracts the thumbnail from Wistia which works fine. However, I need to put the ...
0 votes
1 answer
56 views

how to get the url of a custom uploaded file

For a custom function I need to generate a file, upload it to the upload folder and also access the upload file afterwards to attach the file to an email. For uploading the file I use the ...
0 votes
0 answers
15 views

How to disable direct media file access in nginx or ubuntu for non loggedin users?

I have one requirement, where uploaded files will be visible only to logged-in users, I have tried a solution and it's working perfect in my localhost/ wamp/ apache. But when I move my code to ...
  • 49
0 votes
0 answers
31 views

Cannot upload CSV via REST API: 'Sorry, not allowed to upload this file type.' but it does work through the Wordpress Dashboard

I can upload a .csv file successfully in the dashboard, but when I try and use Python + WP REST API, I get the following error: {'code': 'rest_upload_sideload_error', 'message': 'Sorry, you are not ...
1 vote
0 answers
11 views

I want to customize wp.media (the wordpress admin uploader) in order to change the file name but only in video custom post type

I want to customize the wordpress default admin interface uploader: wp.media. I already created a custom post type named "video" and I added a wp.media element which permits to upload the ...
2 votes
3 answers
360 views

How to automatically convert images to WebP on WordPress?

I want to convert every PNG and JPEG to WebP on upload so that I can serve WebP and PNG/JPEG without requiring the user to upload a WebP version of every photo. I want to save the WebP in the same ...
  • 21
0 votes
0 answers
9 views

Create media folder upon post publish?

Is there a way to create a folder inside the uploads folder each time a post (from a specific post type) is published? For example, I create a post titled "New Post" and once I hit publish, ...
0 votes
0 answers
27 views

How to parse an image that was just uploaded to make sure it doesn't contain malicious code?

Let's assume that an user has just uploaded an image. How do we make sure that the image doesn't contain hidden PHP code that will run once the image is on the server? The most common (and, for ...
0 votes
0 answers
15 views

Changing upload directory and migrating old attachments

I have a requirement, for that, I have to change a CPT's upload folder, which I have achieved by the following code. add_filter( 'wp_handle_upload_prefilter', 'rsg_pre_upload' ); function ...
  • 123
0 votes
1 answer
15 views

How to upload DICOM (dcm) files using wordpress wp_handle_upload?

I'm using wp_handle_upload to allow users upload .dcm files in the wordpress admin panel, and it does not working fine. I am also using wp_handle_upload to upload other file types ( jpg , pdf , png ) ...
0 votes
0 answers
8 views

Indicate image sizes for upload by post type

I would like to do this : add_filter('intermediate_image_sizes_advanced', 'manage_image_sizes', 99 ); function manage_image_sizes($sizes ){ if( ( $_REQUEST['post_type'] === 'foo' ){ $...
  • 800
0 votes
0 answers
15 views

How to limit sizes for specific upload programmatically?

In my plugin I´m doing programmatically image uploads from an xml file like this function : function makeMediaFromUrl(string $image_url, string $title, int $post_id = 0) { $file_array = ...
  • 800
0 votes
0 answers
18 views

Uploaded images result in a file url with full path on disk appended

Problem: When I upload an image using Wordpress media gallery the file is written properly to disk, however the file url contains the full path on disk instead of the relative "/wp-content" ...
0 votes
0 answers
38 views

Show a popup message when file is uploaded

I have to check if a file is already uploaded to the site when I upload a new file (it checks the md5 hash of the new file and compare it to all the other files' hashes stored into the database). For ...
0 votes
0 answers
28 views

Some problems in custom widget

I made a custom widget for my template, which has an image upload section For the first time, I upload an image, it displays correctly, without any problem, but when I want to change the image, it ...
  • 1
0 votes
1 answer
303 views

wp_handle_upload returns a critical error response or invalid form submission

Trying to make a plugin that can upload files directly to WP. Despite copying different blocks of code online, it seems determined to not let me upload it. The way I'm attempting is through a ...
1 vote
1 answer
39 views

Generate metadata for cloud images

The current situation We use the AWS SDK for PHP to store media files on S3 instead of the server's local storage, and use the wp_handle_upload filter to point the inserted attachment to the S3 file ...
0 votes
1 answer
28 views

How does Wordpress decides how many sizes of an image to create?

Once an image is uploaded to WordPress server, how does it decides how many sizes to create for the same image? I can see for one image, it didn't create any variants, but for a bigger image, it ...
0 votes
0 answers
348 views

wp.media Uncaught TypeError: Cannot read properties of undefined (reading 'state')

Here in a JS class, I used "wp.media" to upload images. I can open the media popup by clicking a button. But getting this error (Uncaught TypeError: Cannot read properties of undefined (...
0 votes
1 answer
346 views

How do I upload file through custom field, save it to database and get it

I have made a custom field without any plugin. When I choose file I want to upload that file and get its url on my page. Basically, I want to upload video and show it on frontend. This is my code ...
0 votes
0 answers
19 views

Checking page before applying image restrictions while uploading

so users can upload images on my website and I want to put some restrictions on these images while they are uploading. The catch is that these image restriction can only apply on one page, being the ...
0 votes
1 answer
40 views

Serving Images from subdomain in wordpress

This is my current image url https://example.com/wp-content/uploads/2022/06/sample.png served via cloudflare uploads folder is in my wordpress installation I am syncing the uploads folder to Backblaze ...
  • 1
1 vote
1 answer
369 views

Disabling direct access to images using .htaccess

I have installed Wordpress in a subdirectory of a subdomain. I am using the following rewrite rule to direct all urls to this subdirectory. RewriteCond %{HTTP_HOST} ^(www\.)?mysubdomain.mydomain\. ...
  • 13
0 votes
0 answers
21 views

"Can't update in WordPress"

WordPress changes can't showing. WordPress version: 5.5.3 Node version: 14.19.3 PHP version: PHP 7.4.29 npm version: 6.14.17 There is a website under development in WordPress. I edited the page in ...
  • 1
0 votes
0 answers
10 views

Change image data durgin upload

I try to change image filename and image meta during upload to media library. I have a problem with create unique filename hence, a bad slug is generated. Also, during upload, file uploaded by this ...
  • 1
0 votes
1 answer
41 views

How to stop media_sideload_image from running when deleting a post?

I have a code that downloads an image and saves it to the media library when you save a post that uses a certain block. The code runs perfect but downloads the image again if you delete the post. How ...

1
2 3 4 5
40