News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Using images with same name

Started by barrie, August 30, 2013, 05:33:28 AM

Previous topic - Next topic

barrie

Can anyone throw any light on my little annoying problem ? If I upload an attachment ( image ) in a post and it is called say image.jpg I can see that SMF gives it a unique number and creates a path to that to display it. But if I upload a different image in the same topic with the same name -  image.jpg it overwrites the original one ? Am I doing something wrong here ? I thought they all got unique numbers and paths when they are uploaded ?

Any guidance would be much appreciated.

Storman™

I just tested this out of curiosity and it seemed to work fine for me.   ???

Added two files with the same name to a single post and files with the same name to other posts in the same topic. All worked ok.

What folder permissions do you have the attachment directory set at ?

Thats all I can think of but clutching at straws really. Can't think what to suggest, maybe someone else has some ideas?

Gary

There is a setting that'll prevent attachments from getting unique id's on upload. But this comes at the cost of being able to upload attachments with identical filenames.
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

Illori

Quote from: Gary on August 30, 2013, 07:39:09 AM
There is a setting that'll prevent attachments from getting unique id's on upload. But this comes at the cost of being able to upload attachments with identical filenames.

that setting has not existed for years and i think only existed in 1.1* and was later removed

barrie

Quote from: Storman™ on August 30, 2013, 07:19:51 AM
I just tested this out of curiosity and it seemed to work fine for me.   ???

Added two files with the same name to a single post and files with the same name to other posts in the same topic. All worked ok.

What folder permissions do you have the attachment directory set at ?

Thats all I can think of but clutching at straws really. Can't think what to suggest, maybe someone else has some ideas?
Attachment folder permissions are set at 755.

Did you try it using 2 different images but with the same name ? Thats what seems to happen regularly on my forum. It does not happen immediately - sometimes an hour or so later ?

Thanks for the reply.

barrie

Just found this in Attachment settings probably in an older version :

"Encrypt stored filenames - This is a useful feature as when enabled; you will never have the problem of different users uploading a file with the same name and the older one being overwritten. This also provides an additional layer of security, since it would be harder to link directly to the files in the Attachment directory."

Taken from here : http://wiki.simplemachines.org/smf/Attachments_and_Avatars#Attachment_Settings

That is what is happening - new images with the same name as older ones are being overwritten. That setting where I can tick to encrypt stored filenames does not appear in my Admin section under Attachment settings ?

Any way I can stop this ? I am using the latest version of SMF.

Thanks to all.

Illori

are the attachments in your attachments folder encrypted? do you see the names of the files or just a random set of numbers/letters for each attachment?

thanks for the info from the wiki, i will remove that as it is not in the current version(s)

Arantor

Just to clarify, this option was partially removed in 1.1.9 / 2.0 RC1-1 after it was abused in a major hacking campaign. The previous functionality does still exist to a point, the upgrader didn't go through and modify every single attachment, it just disabled the 'unencrypted' setup for all new attachments, and looked up the old unencrypted name for old attachments.

I'm sort of curious what version this installation started out as. I'd also wonder if, inside smf_settings, there is a value set for variable 'attachmentEncryptFilenames' and if so what value it is.

barrie

#8
Quote from: Illori on August 30, 2013, 08:17:58 AM
are the attachments in your attachments folder encrypted? do you see the names of the files or just a random set of numbers/letters for each attachment?

thanks for the info from the wiki, i will remove that as it is not in the current version(s)
No, they are not encrypted ? They are named using their original upload name i.e image.jpg

So obviously if a new file with the same name is uploaded the old one gets overwritten. There are over 40,000 images in my attachments folder !

How do I get the encryption to be activated again ?

Initial upload was 2.0.2 version. It was a forum migration from Webwiz so I am assuming that the "old" images that were transferred are not encrypted ?

I am now using 2.0.4 version here is our forum : http://www.aircooledrdclub.com/smf

many thanks

Arantor

-sigh-

Quote from: ArantorI'm sort of curious what version this installation started out as. I'd also wonder if, inside smf_settings, there is a value set for variable 'attachmentEncryptFilenames' and if so what value it is.

barrie

Still struggling with this guys if anyone has any ideas ? I have tried to get Forum members to rename their images to something silly but we still get members uploading images with the same name and they overwrite the original image. Really frustrating on a forum like ours where enthusiasts are logging the restoration of their bikes and adding images on a regular basis !!

Following Arantors question : "I'd also wonder if, inside smf_settings, there is a value set for variable 'attachmentEncryptFilenames' and if so what value it is."

There is no variable listed in the smf_settings file for me to change ?

Cheers

Barrie

Storman™

#11
QuoteThere is no variable listed in the smf_settings file for me to change ?

This is not a file, Arantor is referring to the smf_settings table in the database.

Use phpMyAdmin to access the database and see if there is a value set for variable 'attachmentEncryptFilenames'.

(P.S.  If you have a control panel then phpMyAdmin should be in there under the database section. The value will either be a "0" or "1". Check it and report back.)

Arantor

(It's actually quite clear it probably isn't set, but the reason for it not being set is curious because it *should* be set in all new installations for security reasons)

barrie

Quote from: Storman™ on November 14, 2013, 09:42:03 AM
QuoteThere is no variable listed in the smf_settings file for me to change ?

This is not a file, Arantor is referring to the smf_settings table in the database.

Use phpMyAdmin to access the database and see if there is a value set for variable 'attachmentEncryptFilenames'.

(P.S.  If you have a control panel then phpMyAdmin should be in there under the database section. The value will either be a "0" or "1". Check it and report back.)

It is set to "1" in phpMyAdmin.

Thanks for your reply.

Storman™

In that case lets just check your files and make they are all up to date. Can you go to:

Administration Center » Forum Maintenance » Routine

Find "Check all files against current versions" and click on "Run task now".

Are any of the resulting entries in red ?


barrie

#15
Done that and my Language files show up in RED

My version is 2.0 and current version shows as 2.0.4

Shall I upgrade them ? My version is up to date as 2.0.6 ?

I looked at the latest versions and there is english_british but my current ones are just english ?

Storman™

Yes thats wise but I doubt its the source of the issue.

Not quite sure what else to suggest  :-\

barrie

Screenshot of my attachments - as you can see they retain the name given to them even after uploading ? Many thanks for your help but if anyone can throw any light on this I would be grateful ?




Storman™

They will, thats normal, but those names are linked to a unique file hash name which is stored in the database.

You should test it in a dummy topic by attaching an attachment. Then create another post with the identical file with the same name, then see if what happens. Do you get two entries in that attachment list ? Or do you get an error message that stops you adding the second file?

barrie

Thats what I already did. If I attach image.jpg to a post and then attach image.jpg to the same or another post the second one replaces the first one ! It actually overwrites the entry in the attachment list. Bit of a nuisance when we have over 40,000 images on the server.

Storman™

Suggest we check a couple of your files.

Please attach your "Post.php" file (from the /Sources directory) and your "Errors.english.php" from /Themes/default/languages

;)

barrie

Files attached. many thanks for your interest.

Kindred

wrong post.php file...    not the one with the php~
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

barrie

Sorry. Just saw the first post file !!

Its attached.

Advertisement: