No announcement yet.

moved to new server, old attachments not appearing ('failed to open stream')

  • Filter
  • Time
  • Show
Clear All
new posts

  • [Forum] moved to new server, old attachments not appearing ('failed to open stream')

    We have moved everything over to a new server more than a month ago. We just noticed that all the old attachments are not appearing. When clicking the link to an old image attachment, we see the following error:

    [B]Warning[/B]: fopen(/home/username/attachments/1/1/7/8/5/5/9266.attach) [[URL=""]function.fopen[/URL]]: failed to open stream: No such file or directory in [B][path]/attachment.php[/B] on line [B]252[/B]
    we tried searching this forum for a solution but havent had any success for our problem. any ideas for a fix? thanks

  • #2
    Are your attachments stored in the file system or the database?

    Go to Admin CP -> Attachments -> Attachment Storage Type

    It will tell you where they are currently stored.

    If they are/were being stored in the file system then you would have needed to copy the entire folder of attachments when you moved your site- I hope you still have access or a backup. It's possible they were just moved to the wrong location, they need to be in the folder specified in this setting.


    • #3
      Originally posted by BirdOPrey5 View Post
      Are your attachments stored in the file system or the database?
      It says Attachments are currently being stored in the database. Should we move the items from the database to the file system instead?


      • #4
        I would backup your database before attempting but I think it is worth trying.

        It will warn you if the attachment numbers do not match, and if they don't I would not finalize the transfer.

        The problem is the error message you posted, /home/username/attachments/1/1/7/8/5/5/9266.attach, looks like a file system attachment directory.

        Do you have access to the old file system or a backup of files from the old server? If you could view that directory and see if those files exist we'd know for sure.


        • #5
          I'd bet he had them in the file system on the old server, but they are set to database on the new one.


          • #6
            unfortunately we do not have access to the old server since we migrated to the new server 8 weeks ago.

            in moving the attachments from the database to the file system, we get the following message:

            Attachments in Database: 9202
            Total Attachments Processed: 9202
            Number of Attachments that could not be created or are 0 bytes: 8848
            should we go ahead and finalize the move to the database? and does this mean there were 8848 attachments that were not moved over from the old server?


            • #7
              That means you have lost 8848 attachments unfortunately. They were in the file system when you moved your site.

              It's up to you if you want to move them from the database, it won't get back your old files. You will need to remember to backup your attachments folder going forward if you do move them to the file system.

              Keeping them in the database will make your database larger, but it is easier to backup just the database. I don't know how much you use attachments- if they are occasional small files keeping them in the database is fine. If they are often used and/or are larger files (multiple mega-bytes) then moving to the file system will be better for performance going forward.


              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.