I'm building a web site with WordPress, and frequently need to replace a media file--specifically, a Java project exported from Eclipse to an archive, but the same happens with images. To retain the original file name, I "delete the file permanently" from the media library, then upload the revision.
Unfortunately, when I download the file via a link, I get the "deleted" version instead of the new one.
I have disabled the "Organize my uploads into month- and year-based folders" option, so I know the file name is consistent over time.
How is it the "permanently deleted" files don't disappear? And why do they supersede their replacements?
Right now, my choice is to upload the revision without deleting the original; WordPress assigns a sequence number to the revision. I need to change links to match, and the downloaded file will contain the sequence number when used (which isn't very tidy).
This is WordPress 6.1.1.
I've had the same problem quite a few times. What I do now is just use the plugin called Enable Media Replace: https://wordpress.org/plugins/enable-media-replace/ and I don't really have to think about that issue anymore. Maybe this could be an option for you?
Otherwise I think you will have to go in to the database and manually remove the images unfortunately.
Related
I have created a media type that accepts XML files and saves them to a custom publicly accessible location on the server.
Ideally I would like the file to be overwritten when the exact same file is uploaded. This does not happen, instead it creates a new file and adds a number on the end. I have "Create new Revision" turned off.
To get around this issue I thought I could just delete the file via the CMS. The uploaded file has status of "Permanent" and is used 0 places. I know the cron job cleans up files for you, but when I run the cron the file in question is still there. I figure it's because the file is set to permanent, but I don't see a way to flip this to temporary.
Any help is much appeciated.
There is a setting nested away in the file system settings, which lets you configure it to remove (or not removed) orphaned files. If drush isn't removing them despite having no usages recorded, I'd check this option isn't ticked.
The temporary and permanent status are used for storing temporary files during the upload/save process, so I wouldn't tinker with those too much.
If you fancy making the form yourself using the form API, then you can save the file programmatically using the FILE_EXISTS_REPLACE parameter.
https://api.drupal.org/api/drupal/core%21modules%21file%21file.module/function/file_save_data/8.5.x
I'm working on a Prestashop site and recently noticed about the SMARTY features (Menu: Advanced > Performance).
I realized that in order to show changes I made in the css, I must select one of the last two options (first one was selected by default).
Screenshot (I'm sorry the site is in Spanish)
1)Never recompile template files
2)Recompile templates when files are modified
3)Force compilation
My question is: when it comes to an online shop, wich option should I select until I finish editing the code? What's the difference between both?
It may take me a couple weeks to finish the job and I don't want to mess anything up.
Thank you guys.
When you're starting to dev onto the shop, whether it's front or back, you may have to choose the option to recompile when files are modified. I'm always choosing this option because it allows me to develop or debug some files and the server keeps serving cache files to the visitors.
Also you may have to edit the file defines.inc.php file in the config folder in order to define the _PS_MODE_DEV to true, for example like this :
/* Debug only */
if (!defined('_PS_MODE_DEV_'))
if (in_array($_SERVER['REMOTE_ADDR'], array('217.128.240.59')))
define('_PS_MODE_DEV_', true);
else
define('_PS_MODE_DEV_', false);
Doing this so you'll be able to get some logs when you're updating something. Placing your IP into the array keeps everyone safe from seeing the logs (notices for example).
In PS 1.6.
- Configure the SMARTY to "Recompile templates if the files have been updated" then deactivate the option "Smart cache for CSS"
- make the changes in your CSS files,
- delete the folders mentioned sadlyblue in comment.
- and activate again the "Smart cache for CSS" SAVE to recompile theme.
I am unable to view any of the media library documents in the grid view. I can see them in the normal list view. I am also unable to upload any new media files. I have noticed that there are some strange no title files which I think are the cause of the issue but i am unable to delete them as there is no edit or delete button next to any of these screen-shot. My question is is there a way to delete these odd files from the database?
WordPress media files are not actually stored in the database. They are stored under a folder structure in your web root folder.
If you can make an FTP login, you can get rid of the odd media files as follows:
Make FTP login
Navigate to the wp-content/uploads folder
Under the uploads folder, you will find folder/s like 2016, 2015 etc. (depending on how old your site is)
Within each year, you will find monthly folders
Within each monthly folder, you will find the media files (that you uploaded during that month/year)
Browse around to find the offending files and delete
Hope this works for you.
Edit: You can also try one of the following plugins:
https://wordpress.org/plugins/enhanced-media-library/
https://wordpress.org/plugins/media-library-plus/
When I upload image to WordPress, they randomly appear as broken links.
I can drop the files on the Media Library or Select the files and some files are always shown as broken.
I can delete the files and re-upload the same group and different images in the group can show as broken.
I'm sure it's nothing to with the images as they sometimes appear as broken and then sometimes don't.
Locally the upload works fine, this problem started happening on the live hosting - I thought it could be something to do with permissions but then wouldn't it show all the images as broken and not show random images as broken.
I don't get an error but a broken image icon. If I click the broken link it case me to the Attachment Details page. Sometimes the image does appear here sometimes it doesn't.
Some things to look for:
1) check if there is an .htaccess file in the wp-content/uploads folder or wherever you keep your images (make sure you have the option to see hidden files--I think they're available by default when you're using an FTP client but if you're in the File Manager of your CPanel then you have to enable this option, either before entering file manager or from settings when you're in the file manager depending on your host). If there is an htaccess file, you'll want to back it up and then research more about this before you make any changes to it. https://codex.wordpress.org/htaccess_for_subdirectories
2) if you had tried to move your default image directory using wp-config.php make sure that has been set up properly
3) check folder and file permissions settings. it's best to do this in an FTP client because if you need to change the permissions, it can do it recursively and include all subdirectories and files within them instead of having to go through into each folder and change the permissions.
http://www.wpbeginner.com/wp-tutorials/how-to-fix-image-upload-issue-in-wordpress/
I'm having some trouble with an Umbraco website. Some times some Media files disappear.
The nodes still exist but the actual 'physical' file is gone.
Also the folder the media file was in doesn't exist anymore.
The users of the CMS are unable to log in on the server, so they couldn't accidentally delete the files them self. Only me and my colleagues have access (and we wouldn't log in to a server unless it's necessary)
I just checked the disk space, and there are several gigs on all disk available.
We did a migration of the media folder some time ago, so we thought it might have something to do with it. We have analysed the file system backup of the whole Media folder and those items are not there as well so we can exclude the possibility of a problem on the filesystem.
The version we are using is: Umbraco v 4.7.1.1 (Assembly version: 1.0.4868.25172)
If you clone content nodes with media files attached using an Upload property type, both nodes will point to the same media element. If you replace or remove the file on one node, it will remove the physical file. The original node will still have the reference to the removed file. This makes it appears as if a ghost is deleting images, but its Umbraco 4 deleting the file when you publish your change.
The best way to solve this is to convert your property from type Upload to type Media Picker.
I had this problem in sites around umbraco v4.5. I never run into this issue on Umbraco 6 and 7. But, on those systems, I use the media picker instead of upload for all media-like elements.
There are no issues I know of with Umbraco 4.7.x deleting its own media. It is possible to do it remotely, but that would delete the nodes as well as the physical files.
The only cause is the one which seems most unlikely, and that is someone has accidentally deleted them. I find this occasionally happens when deploys are done. Someone replaces the media folder with the one from the staging environment.
I have also seen an issue if files are copied across an RDP connection, the files being copied are not copied completely and in the process some actually disappear from the target folder.
But either way, I would check your internal processes, maybe move the media folder to a virtual directory to avoid the chances of it being overwritten.
There is one case in which media files might be deleted, and that is when you are using the Upload datatype on a document type.
What happened before on a system that I managed was that editors copied a page that included an image previously uploaded, but never updated the image, leaving the same path as the value for the Upload field.
In this scenario, you would have 2 published pages that have a field with the same path.
Now, if one editor decides to delete the page, the media file is also deleted.
This would leave the copied page with a broken link to the image and a missing image.