Wordpress renames files when no duplicate is found - php

I have code that relies upon a certain file naming convention. When I stopped working locally and made a new database and setup online and went to upload the images for the posts. Wordpress adds a -1 or -2 to my images even though it is a fresh db and fresh wordpress install.
The naming conventions I have are like so..
cover_somename.jpg
cover_somename_bg.jpg
Why would it make my files like cover_somename_bg-1.jpg when there are NO DUPLICATES in the media library. How can I turn this renaming feature off/ rename the files myself.

When you upload image on local it will create move image to upload folder. And while you moving project to live you create new data base you have only remove the image name from the data base table.
But you image still remain on Upload folder under the month folder that you have added
When you upload the same file name on live server on same month then it will check for "if file already exist or not if already exist then it will rename new uploaded file as you get.
you create new data base so you old image wouldn't display on admin so you need to clear the folder under the upload folder then it work fine please try once.

Ah images aren't in the DB turns out they are in uploads folder and if the uploads folder has images but its a fresh install the media library will be empty but will act like it has those files and renaming will occur.

Related

File upload in codeigniter in shortcut folder

This is not the first time I am doing file upload using CI. However in this particular case I want to upload images or files to shortcut folder created at project root. This is what my project root looks like in following image:
So basically what I had been trying to do is using php filesystem function is_dir('goku') (goku is shortcut folder as shown in above image that links to C:\Users\Name\Desktop) and if true then create a sub-folder inside it and insert the image or file in that sub-folder. However I didn't find any way to make the shortcut folder recognize as directory and returns file upload error -The upload path does not appear to be valid. Upload works fine on other folder. I know that php is not recognizing the shortcut folder as directory because on running is_dir('goku') returns false. I have gone through all probable solutions but now again back to where I started. Any helpful hints regarding this is highly appreciated. Thank You!!!
Using the library Codeigniter
library upload single file and multi file
Easily upload .

Upload folder using Google Drive PHP API

I want to upload a folder of files to Google Drive, using the PHP API. I can upload a single file to my Google Drive, but can't seem to upload a folder of files...e.g. a folder containing some Word documents and PDFs. Does anyone know if this is possible?
Files: insert Insert A new file
In instances like this the documentation can be a big help. File.insert is for inserting A file as in one singular. If you want to insert more then one I suggest you look into using a loop and looping over each of the file you would like to upload.
Tip:
setting the mime type as follows creates the initial folder
mimeType = 'application/vnd.google-apps.folder'
Note the file id when that is created and set the parent of the files up upload to that and they will be uploaded into that directory.

Laravel showing deleted files also

I have created a simple upload form which resizes, encode to jpg (with help of intervention) and uploads the image to the directory public/profilepics/user['id']/profile.jpg.
Next I created a simple function delete to delete the picture from above mentioned directory.
The upload form also show the current profile.jpg in the respective folder. But when I have successfully deleted the picture(I confirmed by looking into the public/profilepics directory in file browser), I still see the old picture. After uploading another image, again I see the old image only.
Do laravel have remembering capability or have internal cache(I am not talking about the cache service include in laravel This one) which should be cleared to see the new image.
Actually I was working on updating profile picture page and encountered this problem.
Leave the comment if any of the file is needed.

Force Wordpress media library to index files uploaded from ACF file upload field

I've created an ACF file upload field, in order to attach pdf and image files to each post I create.
the problem is, when I want to Re-Use those files - they don't appear in the media library, but they do appear in the "uploads" folder on the server.
Is there a way to force the media library to index those files?
They certainly should be appearing in the media library so it sounds like a configuration issue. Are there any errors appearing when you upload the file? Perhaps also check your server logs to make sure there is nothing being reported when you try and upload the file...

Uploading multiple images in SilverStripe 3.0

I'm using SilverStripe 3.0 and I need some help around here. I have a many to one relation between pages and images (I'm creating an image gallery). The images are uploaded into the right folder, but the CMS seems to save the wrong path for them. I'll explain a little more detailed:
I load the image in the uploader, it shows me a thumbnail while uploading. But when it finishes the upload the thumbnail disappears.
When I click the Edit button I see that it's looking for the image in the /assets folder (like /assets/picture.jpg), but it was uploaded to /assets/Uploads.
I tried setting a different upload folder using $FileField->setFolderName(), but it always looks for the images in /assets besides it uploads them in the right folder.
Any suggestion?
This was a known bug that should be fixed with the 3.0.4/3.0.5 release.

Categories