Attachment Field - Where Are the Files Stored?

Hello! I am trying to create a custom file-type field in the customer view that allows for file uploads. I created the “Attachment File” field of type File and added two variables to the editviewdefs.php file, which are enctype and the post method.

With all of this in place, the “attachment file” field is visually displayed as intended, allowing files to be uploaded. However, when I try to view the file and click on it, a popup window opens with the message shown in the image, which, as I understand, means the file cannot be found.

My question is, how can I make the file be stored in the accounts table in the database? I see that the file is uploaded to the “/upload” folder, and I can view it from there, but not from the customer view in the CRM.

I can’t seem to figure out this small detail to understand it. Additionally, I can’t remove the file to select another one; it won’t let me delete it. What am I missing?

Could you help me?


image
image

I don’t know if suitecrm comes with File field in-build. How did you create that file field?

Other option is to get add-on like below:
file-field

I did it through code, specifying that this field is of type “file”, but I’m missing a “final touch” to fully understand what I need to do for the part where it saves (it does save in the /upload folder), but it doesn’t let me view it when I try to open it from the view where I created it. I’m missing that detail, so to speak.

So in suitecrm filed get stored at upload folder in encrypted format. I don’t know if you can view it on module’s page, but files usually get download on your local system to access.

Sometimes, the browsers stop downloading too. You can try it on different browser.

For that, you need remove button besides file upload field. Did you add that code too?

I tested it in different browsers, and I get that error which doesn’t allow me to view it.
No, I didn’t add it to the “remove” button. When I defined the field as a “file” type, the button, the eye icon, and the link that opens a blank window where the file should be displayed were automatically configured.

That’s good! Check in network or console tab of the browser which path it is trying to access. Maybe it will help you to debug issue.

Sorry, but this is wrong :point_up: . Please see my blog post. You can open the files, they’re not compressed, they’re not encrypted, your OS is probably just confused about how to open them because of the missing filename extension.

And there is a File Field in SuiteCRM, I don’t think add-ons are needed for this. If they are, then you can use a free add-on that even allows multiple files to be added.

Hello pgr! Thanks for your response. I’m going to read your blog to better understand it and see if it helps with what I’m trying to do.

I’m attempting to create an attachment field because I was asked to include it within the Accounts module as just another field, but in the Studio, there’s no “file” field type. That’s why I’m trying to do it by code, like the free add-on you mentioned.

Regarding the recommendation about the free add-on, I’ve also seen it and tried to use it in the CRM, but it didn’t work because the CRM version I’m using is 7.14.4-debian. The free add-on isn’t compatible with this version. I wish it worked—I would be using it!

You can ask @p.konetskiy if he has a newer version, it’s likely that he has.

Alright, pgr, I’m going to reach out to him to see if he has any new updates available. Thank you very much for your responses!