phpBB to SMF 1.05 Attachment Error

Started by jsdoyle, August 13, 2005, 09:59:27 AM

Previous topic - Next topic

jsdoyle

Sorry for posting this again but I felt it needed it's own thread. Previous Post

Big Bug in SMF after the of attachments from phpBB 2.0.17 to SMF 1.05 conversion.

All attachments get converted.  They are listed in the database with the correct file size and all but in the posts some show 0 KB for the file size and won't load.  Others display fine.

Here's the problem.

SMF doesn't like attachments that have spaces in their filenames.  So it displays all attachments with spaces in the file name prior to the recount as having 0 KB and it won't load it.

Do a recount of the attachments and SMF removes all references to attachments that are either 0 KB or ones that have spaces in the filenames.

The attachments aren't deleted from the attachment folder but simply removed from the database attachment table.

The structure of the smf_attachments table is fine and all attachments are listed (names with and without spaces) prior to the recount.

So, we need a fix for imported attachments that have spaces in thier filenames.

I just posted two attachments after recounting.  One with a space in the filename and one without.  Both display fine when uploaded within SMF.  So it likes spaces as long as they are attached from within SMF.

Klauser

Hello,

some days ago I converted also from 2.0.17 to SMF 1.1 Beta 3 Public , I suggest you to install also 1.1 Beta.

Here are my steps :

- Install SMF 1.1 Beta 3
- Go into SMF Admin > Attachments - choose Crypt Attachments that will replace the Space in the Filenames , choose show picture as Attachment in Posting ( don´t know what there stands in english, using the german language )
- Rename the PHPBB2 Attachment folder to  "attachments" , possible it is called "files"
- Get the new Converter 1.1 http://www.simplemachines.org/community/index.php?topic=38966.0 and Upload it with the new SQL File too
- Start convert.php ... possible you will noticed one Error about the Attachment Import but with the next try it said OK
- Rename the phpBB2 Folder back to original Name, if it was not Attachments
- Go into Admin SMF and controll under Member Access that your Normal User can See the Images 2 x , check also if your Forum Acces for each Board is on Global and not on Local

If there are any problems with viewing some attachments, download the 1.1 Upgrade Version and Upload only the upgrade.php to your Webserver and start it , that will possible fix some Problems.

I think I forget nothing, this should work....


jsdoyle

I've tested SMF 1.1b3 as well and have problems with the conversion.  None of my attachments convert.   I've decided to stick with the release version of SMF for the forum I'm converting since it is suppose to be supported and stable. 

The only problem I have right now with SMF 1.05 is the issue with the attachments with spaces in their name not being recognized properly after the conversion (see above).

Also, I like using MKPortal which I've read is not compatible with SMF 1.1B3.

Waiting for SMF Support.

Thanks,

Scott

Klauser

#3
I just checked my phpBB Folder, why you have Spaces in the physical File Names ?

The Attachment Mod from Acyd are storing 2 Names , one for the physical Folder (Webspace without Spaces , they are replaced with "_" after the Upload ) and one for the Display inside the Posting with Spaces.

The latest mod was

   2005-07-16 - Version 2.3.14
      - seperated pre-modified files from the Mod and made them downloadable as a seperate package
      - updated pre-modified files to be compatible with the latest phpBB-Version
      - fixed bug with umlauts in filenames
      - updated create_thumbnails.php script to abide to the minimum thumbnail size - thanks to weightweenies
      - fixed typo in routine for determining when to refresh the posting screen - thanks to Meithar
      - invoke correct thumbnail display if storage path is outside of webroot


jsdoyle

My version of Attachment Mod for phpBB is 2.3.9

It is not the actual file name in the Attachments Folder.  It is the name of the file stored in the database table.

The smf_attachments table has a field named "filename".  When you upload a file named "test image.jpg" that is how it appears in the database table.  But the actual file in the Attachments folder has the spaces replaced with an underscore "_".

So those attachments with a filename in the database that has spaces in the filename are converted by SMF but will be deleted once you recount the attachments in the admin section.


jsdoyle

I updated the attachment mod version on my phpBB to the latest version and tried to convert again.  I got the exact same result as before.

0 KB attachments with spaces in the filenames that are removed when you recount the attachments.


Klauser

#6
Here you can see,  that I had no problems with spaces , the file was uploaded in 2004 under phpBB2 and converted correct to SMF

http://img40.imageshack.us/my.php?image=spaces5xg.jpg


jsdoyle

I'm happy for you.  :D

But that is the only thing I can find with my converted attachments.  They convert fine, are listed fine in the database, but SMF displays the ones with spaces in the file name as 0 KB.  Here's a link to a post with two attachments that was made yesterday.  Both have spaces in their file names:

http://www.afte.org/forum/smf1/index.php?topic=1207

Now here is a post that has no spaces:

http://www.afte.org/forum/smf1/index.php?topic=1195

If I go to attachment manager and have it recount the attachments all of those with 0 KB dissappear from the posts.

I can't understand it since the files are in the folder.

If you can think of some other reason for the error I'd love to hear it.

Thanks,

Scott

Klauser

Did 1.05 had the option under Admin to store the files encrypted ? That was suggested in an other thread if you want use Spaces in the File Names... that is what I wrote also in my first answer, I marked this option before I import the phpbb files.


jsdoyle

It does have the option and it was checked.  I unchecked the option, saved it and tried it that way.

Same results.

Scott

Klauser

#10
Content of dir´s

phpbb2
\attachments\ufo_-_14.10.04.jpg

SMF
\attachments\443_Ufo - 14_10_04_jpg2b0254ffde39d59e973429fb4f06c096

You start confusing me  ::) SMF had spaces in the Name but it still works, also the file is still there after a Resync. I should not talk longer about that, before I become the same problems as you hehhehe.

You had enough Space on your Webserver or ? I know that from a full Space, If you start Uploading Files they are all with 0 Bytes.

jsdoyle

I can upload a file with spaces in the name while in SMF.  it is no problem.

It is only those with spaces in their name from the database that when converted from the phpbb install end up listed as 0 KB and disappear when I recount the attachments.

The problem is that SMF imports the data in the phpbb attachments database table exactly as it is in the table.  When it converts the actual files it renames them using underscores to the file names.  Doing this disconnects the database stored name from the actual file.

I guess that's what's happening.  Hell, I'm certainly not an expert at this!  :D

I would really like to hear from one of the admins here on the subject. 

Scott

jsdoyle

You know, I test 1.1b3 and get all kinds of feedback and help from "unknown".  He fixed that problem and I hope I helped in making someone else's conversion easier.

But I have a problem with a conversion from 1.05 and I can't get one support person to even comment on the problem.

I guess my problem is unique to me and something I'm doing wrong or not thinking of.   Or could it be that the problem actually is a bug in the release version/converter and no one want's to admit it or tackle the problem.

One way or another I'd like to know. 

I'm actually beyond the issue because I couldn't get any support I just decided to re-upload all 290 attachments that didn't convert properly.  Because I had to get the forum back up and running over the weekend.

But again, I'd like to help because my issue may come up again and this thread might help.

With no support people addressing this issue it makes me wonder if I've made the right decision in setting up SMF as the forum on 7 different websites I run.  One of the big selling points on this site and for SMF is the unlimited support that comes with it.

Where is it?

Sorry to be so negative.  I realize you guys may be spending most of your time developing the next version but don't forget to support the present "stable" version.

Scott

Oldiesmann

It appears that SMF is not converting the spaces in the filenames to underscores, so it expects to be able to find one with an _, yet when it doesn't, it deletes the attachment info from the database because it doesn't think that file exists.

Try this and see if it works:

phpbb2smf.php

Find
$newfilename = $nextID . '_' . strtr($row['filename'], '.', '_') . md5($row['filename']);

Replace
$newfilename = $nextID . '_' . strtr($row['filename'], array('.' => '_', ' ' => '_') . md5($row['filename']);
Michael Eshom
Christian Metal Fans

jsdoyle

Quote from: Oldiesmann on August 22, 2005, 07:34:46 PM
It appears that SMF is not converting the spaces in the filenames to underscores, so it expects to be able to find one with an _, yet when it doesn't, it deletes the attachment info from the database because it doesn't think that file exists.

Try this and see if it works:

phpbb2smf.php

Find
$newfilename = $nextID . '_' . strtr($row['filename'], '.', '_') . md5($row['filename']);

Replace
$newfilename = $nextID . '_' . strtr($row['filename'], array('.' => '_', ' ' => '_') . md5($row['filename']);

Yes I would agree that this is the case to a point.  Actually the files are still listed in the database until I do a recount.  Then those that are unattached are deleted from the database and then they are no longer listed in the post as an attachment.

Right now, I'm stuck.  I had to get the forum converted over last weekend.  So now I have a number (about 280) of attachments that are listed as 0KB and are unattached to the actual file.

I can't go back and run phpbbtosmf.php again.

But since I have not recounted my attachments they are still in the database.  So what I really need is a sql statement that will find the errors in the attachments table and fix it.  I would be most grateful for something like that!!

Thanks,

Scott


BigPapaPorsche

oldiesman I am having the same issue described here.  I tried your replacement code and the script fails to run.  any suggestions?

jsdoyle

Just to let you know.  I had this problem on the upgrade to 1.05 but when I updated the forum (with the errors) to SMF 1.1 RC1 it fixed it.  So try to upgrade your 1.05 version to the RC2 version and your's may get fixed too.

Scott

BigPapaPorsche

Did you have to do any special sequence of events in the admin panel after the 1.1 upgrade?  I was able to upgrade successfully and the correct file sizes were displayed but no pictures,....I try the file maintenance options in the admin panel but that also deleted the files from the posts just like 1.0.6,......

BigPapaPorsche

#18
So I have successfully converted my second phpbb board to SMF.  The only issues I still face to make the transition 100% is this attachment with space in the name issue.  The conversion scripts copies the files over and creates entries in the data base for the files but does not display the images.  I followed the recomendations of others and upgraded to 1.06 first then to rc1.1 but that does not fix the issue.  When I go to the admin area then file maintenance  this is what is displayed


The follow errors were found during maintenance. Check the box next to the errors you wish to fix and hit continue. 
146 attachments/avatars have an entry but no longer exist on disk 
7 attachments/avatars are being reported as the wrong filesize 


If I click the check box for the 146 error SMF will remove all the entires to the files with spaces in their names,........

After looking through the database I notice that all of the entires in the attachment table that have the issue have nothing under height and width,......if I manual enter the correct data in the fields it still does not work,......


here is an ls of one of the files mentioned,.....

-rwxrwxrwx  1 apache apache  105352 Apr 13 08:11 8_scan0003 (Medium)_jpg2e21116d7e20d35cfa4b2486454a0da0

Here is the entry for this file in the database,.....

ID_ATTACH  ID_THUMB  ID_MSG  ID_MEMBER  filename  size  downloads  attachmentType  width  height
8 0 40 0 scan0003 (Medium).jpg 105352 40 0 800 540


I am not sure what the next step would be to fix this issue,.......

BigPapaPorsche


Advertisement: