⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Upload in a specific directory



drjonesx

drjonesx
  • profile picture
  • Member

Posted 15 November 2014 - 12:21 PM

Hi

Is there some one that can help me to do that?

 

I need to have an upload that is made in fonction of the product and categorie selected

Example

Category : car
Product : v1.1
files: xxx.exe

the needed upload result is 

../upload/car/v1.1/xxx.exe

 

In advance, thanks for your help

 

PS: i have also Teamviewer if it easyer :-)

 


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 16 November 2014 - 10:41 AM

well.. we can do that ... u code it - i give u the logic

 

if $crud->getState() == 'add'

 - set the upload path to regular / normal wherever u have it.

u can have a callback_upload or callback_after_upload ... whichever suites you.. to move the uploaded file to the set location.

But - 1 thing - make sure you disable the upload / hide the upload (whatever suites) till the category / product is selected. Post the selection of both - enable the same.

 

Now - other important stuff..

if $crud->getState() == 'edit'

 - Retrieve the primary key for which the record is getting edited (either from the url or from the getStateInfo() function)

 - Retrieve the row .. and get the selected category / product.... (based on the ids of respected selected and stored in the table)

 - Now set the uplod path to upload/<category_name>/<product_name>

 

this will allow the user to directly manage the file set location.

 

Hope you can now crack a deal on the same :)

 

Happy GCing :)