Jump to content

File (Photo) Uploading !


Recommended Posts

hi everybody

i am new to prestashop, building some functionality into my prestashop installation.

i am doing a module that adds some extra fields and tabs into the backoffice.

its fairly easy after following the guides of tutorial and some info given by a member to add text fields and set values.

but although i've searched a lot i cant find any info on how to upload an image file associated with the value of a text field.

1) how can i have lets say and image field associated with the value of a text field ?

for example i create my form and i have :

'input'=> array (
  array (
  'type'=> 'text',
  'label' => $this->l('configuration value'),
  'name' => 'customproductmyring',
  'size' => 20,
  'required' => true
),

array (
  'type'=> 'file',
  'label'=> 'upload charm',
  'name'=>'charm1',
  'display_image'=>true,
  'desc'=>'here you upload charms',
  'accept'=>'image/*',
  'required'=> true,
  )

how can i save these two values together ? shall i create a new db table and add the name of the photo and the value of the text field on another column ?

2) i am using the helperform class to generate the form. i catch the contents of the form in the getContent function. any ideas how can i upload first the file of the photo ?

from what i understand i should not use the standard html way of creating the form and i should use the helperform class like i do. but this way i dont create a port object to send info about the photo !!!

going through the classes i saw FileUploader, ImageManager. should i use functionalitites from these somehow ? is there a post object which carries the info of the photo ?

 

thanks in advance to anyone who might spend some time helping me.

Edited by papadoepsa (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...