Page 1 of 2

image upload on account edit/create

Posted: Thu Feb 17, 2022 2:03 pm
by LeeFoster
Afternoon all,

I am working on adding an image upload to the account edit & create pages using a hook, I believe I have most of it done but I am having an issue when trying to upload the image.

When I try to do the upload I am getting the below error. I know I must have missed something or I'm not including a connection to the class so if someone can help it is much appreciated.
Fatal error: Uncaught Error: Class 'upload' not found

Re: image upload on account edit/create

Posted: Thu Feb 17, 2022 2:23 pm
by ecartz
You have to copy the class from admin/includes/classes/ to one of the catalog locations, e.g. includes/system/override/

Re: image upload on account edit/create

Posted: Thu Feb 17, 2022 2:44 pm
by LeeFoster
ecartz wrote: Thu Feb 17, 2022 2:23 pm You have to copy the class from admin/includes/classes/ to one of the catalog locations, e.g. includes/system/override/
Yep, that got rid of the error. Now I just need to figure out why it doesn't upload the file or insert the file name into the DB.

Re: image upload on account edit/create

Posted: Thu Feb 17, 2022 3:30 pm
by ecartz
LeeFoster wrote: Thu Feb 17, 2022 2:44 pm Now I just need to figure out why it doesn't upload the file or insert the file name into the DB.
Did you change the form enctype to match the other forms where an upload occurs? E.g. https://github.com/CE-PhoenixCart/Phoen ... t.php#L114

Re: image upload on account edit/create

Posted: Thu Feb 17, 2022 3:45 pm
by LeeFoster
ecartz wrote: Thu Feb 17, 2022 3:30 pm
LeeFoster wrote: Thu Feb 17, 2022 2:44 pm Now I just need to figure out why it doesn't upload the file or insert the file name into the DB.
Did you change the form enctype to match the other forms where an upload occurs? E.g. https://github.com/CE-PhoenixCart/Phoen ... t.php#L114
I'm gonna say yes but we both know I didn't so I'm going to go look into that now

Re: image upload on account edit/create

Posted: Thu Feb 17, 2022 3:57 pm
by LeeFoster
Made progress and have the function working for when I'm editing an account, need to get it to insert now for new accounts.

Re: image upload on account edit/create

Posted: Thu Feb 17, 2022 5:43 pm
by LeeFoster
@ecartz is a hook the right way to do this or is creating a customer data module a better option?

Re: image upload on account edit/create

Posted: Thu Feb 17, 2022 6:13 pm
by ecartz
You can use the same customer data module on both pages. You'd need two hooks for that.

Re: image upload on account edit/create

Posted: Thu Feb 17, 2022 6:29 pm
by LeeFoster
ecartz wrote: Thu Feb 17, 2022 6:13 pm You can use the same customer data module on both pages. You'd need two hooks for that.
So customer data module is better then

Re: image upload on account edit/create

Posted: Fri Feb 18, 2022 12:00 pm
by LeeFoster
Working with the cd modules and have the file upload showing I just need to get the file to upload and the data in the the db now.

If anyone has done this or has any ideas please shout up.