Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporting attachments from the DB into files #1501

Open
james0795 opened this issue Jul 6, 2023 · 2 comments
Open

Exporting attachments from the DB into files #1501

james0795 opened this issue Jul 6, 2023 · 2 comments

Comments

@james0795
Copy link

Hi,

I am currently trying to export attachments direct from the DB using some java code, however I am having trouble as when I output the 'content' field from the attachment_chunk table to a file, it is never recognized as the file type its supposed to be.

For example If I write the content field for an attachment that has a single chunk and is a jpeg to a xxx.jpg file. It does not open in any viewer as its not recognized as a jpg file.

Does this data need to be converted first before I write it to file? Is there something else I am missing on how these attachments are stored?

Thanks

@glensc
Copy link
Member

glensc commented Aug 1, 2023

Typical XY Problem. What are you trying to do?

You may find it much easier to switch from database storage to file storage and then copy the files from filesystem.

➜ ./bin/console.php eventum:attachment:migrate   --help
Usage:
  eventum:attachment:migrate [options] [--] <source_adapter> <target_adapter>

Arguments:
  source_adapter             
  target_adapter             

Options:
      --chunksize=CHUNKSIZE  
      --migrate              
      --verify               
  -l, --limit=LIMIT          
  -h, --help                 Display this help message
  -q, --quiet                Do not output any message
  -V, --version              Display this application version
      --ansi                 Force ANSI output
      --no-ansi              Disable ANSI output
  -n, --no-interaction       Do not ask any interactive question
  -e, --env=ENV              The Environment name. [default: "dev"]
      --no-debug             Switches off debug mode.
  -v|vv|vvv, --verbose       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

@glensc
Copy link
Member

glensc commented Aug 1, 2023

It's actually even pretty well documented:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants