This topic is locked
[SOLVED]

 Files upload help by Cutom Button

1/25/2021 5:16:05 AM
PHPRunner General questions
I
Ivan van Oosterhout author

Hi all,
This time i really need your wisdom,
With a Custom button (Server code) i create 3 files and place them in a \Orders directory.
Article_0000059.dds

Job_0000059.dds

Excel_0000059.xlsx

This works fine,
Later in the Custom Button server code i want to pickup these files and Add them to the documents. These needs to be added as separate files in the document center. Table docs i have created.

Document is medium text field.
I even attach the files to my email, this works fine too.

$attachments = array(

array('path' => getabspath($Files1)),

array('path' => getabspath($Files2)),

array('path' => getabspath($Files3))

) ;
I have seen lots of articles and tried many codes but i cannot get it to work.

Lots of articles tell me to place the code in the Before, but the files are not created in the Before added event.
What is my best options in code in a custom button?

The files can be copied from \Order to the \files. That doenst matter me at all.
Kind regards,

N
Nir Frumer 1/25/2021

hi

I think that your "fastest shot" will be

taking a look at how phprunner ise saving the file information and recreate it manually

  1. if file names don't repeat you can skip the random letters that the control adds
  2. this is an example code...

    [{"name":"files\/cfdi\/FGU.681736_muvye390.pdf","usrName":"FGU.681736.pdf","size":118896,"type":"application\/pdf","searchStr":"FGU.681736.pdf,!:sStrEnd"}]
    hope it helps,

I
Ivan van Oosterhout author 1/26/2021

Hi, Thank you.
I understand what you mean. I was looking at this structure to recreate it.

For now i have created a downloadable link, that works also.
Kind regards,



hi

I think that your "fastest shot" will be

taking a look at how phprunner ise saving the file information and recreate it manually

  1. if file names don't repeat you can skip the random letters that the control adds
  2. this is an example code...

    [{"name":"files\/cfdi\/FGU.681736_muvye390.pdf","usrName":"FGU.681736.pdf","size":118896,"type":"application\/pdf","searchStr":"FGU.681736.pdf,!:sStrEnd"}]
    hope it helps,