Forums

Files upload-problem

Fredolino 22 Dec, 2015
Hello there,
something I'm still wrong, because in my Joomla articles All data is displayed, except the linked PDF and picture.
The Joomla registration also works.
Thank you in advance for your help.
F.
GreyHead 22 Dec, 2015
Hi Fredolino,

The custom code is *before* the Files Upload action so when it runs there is no file data to use. Please change the order.

Bob
Fredolino 22 Dec, 2015
:-) Yes, is ok...

in Action "Joomla Article" / Joomla Registration me started after sending the form in Joomla is not displayed (screen).
My settings:

Designer
Field Name -> Name
Field ID ----> name

Setup
Joomla Registration
Name -> Name
User Name -> Name
User Group -> is ok.
Members Update -> Auto active

Joomla Article
(screen1)
Access level should not be public, so I have there a "0" to enter?
GreyHead 23 Dec, 2015
Hi Fredolino,

Sorry I'm not clear what is not displayed? The form 'Status' is checked so ti should be published.

The Zugriffesebene setting should probably be 2 for Registered Users.

Bob
Fredolino 23 Dec, 2015
Hi,
yes, Number "2". Thanx!

I have now in the form file upload field created by the demo form "demo-fields-multiplier", get now but still receive an error message (screen). Probably it is the script for "Joomla Article"?
In the designer I have for the fields these values:

FileField:
Field Name: file [__ N__]
Field ID: file -__ N__

Text box:
Field name: text [__ __ N] [data]
Field ID: text__N__

In Setup
I have for the action "Joomla Article" the:
<td> <a href='{$form-> files ['file -__ __ N'] ['link']} '> {$ form-> files [' file -__ __ N '] [' name ']} </ a> </ td>
Best regards
F.
Fredolino 23 Dec, 2015
Hi,
I have now tried it at the end with the script in the Joomla Article Action:
{$ form-> files ["__ N __"] ["-__ N__"] = $ form-> data ['text__N__ "]}
but is still not shown me. Seems to me too complicated ...
Perhaps there is a simpler solution in the event that the file upload field more than one file to be uploaded.
Can you select the FileField multiple files at once and upload? These files should be me then appear as links in Joomla Article action in post.

:-)
GreyHead 24 Dec, 2015
Hi Fredolino,

Can you select the FileField multiple files at once and upload? Yes, you need to set 'Multiple' to Yes in the ile Field element settings and change the name to an array name ending in []

Bob
Fredolino 24 Dec, 2015
Hi,

yes, I did like in the FAQ, but to me the files are not displayed in the Joomla article.
Somewhere I have a mistake ....

All data is displayed, only the PDF links not.
That's Costum code snippet for my new items

  <tr>
<td>Lebenslauf</td>
<td><a href='{$form->files['dataup']['link']}' >{$form->files['dataup']['name']}</a></td>
	</tr>


Im File Upload-Action:
Datei-Config:
dataup1:pdf
dataup2:pdf
dataup3:pdf

Array-Fields:
dataup

And in designer I have the data field set up (screen, Screen1)
Overall, it looks like this in Setup (Screen2)

Merry Christmas
F.
GreyHead 26 Dec, 2015
Hi Fredolino,

You have your code mixed up in here
<td><a href='{$form->files['dataup']['link']}' >{$form->files['dataup']['name']}</a></td>
To show values from the $from->files array you have to use PHP tags and 'echo' the value you need e.g.
<?php
echo "<td><a href='{$form->files['dataup']['link']}' >{$form->files['dataup']['name']}</a></td>";
?>

Bob
Fredolino 06 Jan, 2016
Hello,

I wanted to start no new post.
The File Upload a file works (photo).

In the PDFs I can, for example, although 2 files again but select
How can it be that my selected PDF files are not uploaded and the file names are not stored in the table?

Currently, the state of the settings:

Designer / FileField
Field Name: dataup []
Multiple: yes
Extra params: accept = .pdf


Setup / Files Upload Action
File Config:
dataup: pdf
Photo: jpg

Upload path: empty
Array Fields: dataup [0], dataup [1], dataup [2], dataup [3], dataup [4], dataup [5]

DB Save-Action
under Model ID store: yes
Multiple save: no
Model-ID: Data
Force Save: no

The field in the database table is: "dataup" (Type: Text)

The query with <? php pr ($ _ FILES)?; gave the result: screen.

Thanks in advance.

F.
Fredolino 06 Jan, 2016
Hello,

I'm a little further. This article helped me:

http://openstackwiki.org/wiki/Chronoforms_v5_Multi_Dateiupload..._k%C3%B6nnen_nicht_mehrere_Dateien_ausw%C3%A4hlen

The files are stored in the folder.
But the file name must be stored in the table?

And in my e-mail is:
array ( 0 => '20160106150820_Rechnung_2015_01_18632743000891.pdf', 1 => '20160106150820_Rechnung_2015_02_18760250000891.pdf', )

F.
GreyHead 06 Jan, 2016
Hi Fredolino,

The data in the email shows that you have an array of file names, to save that into the database you probably need to 'impolde' the values to create a comma separated string in the same way as the checkbox data.

Bob
Fredolino 06 Jan, 2016
Hi :-)

My tests:

1. Test
Setup / Files Upload
Array-fields: dataup,dataup,dataup,dataup,dataup

Setup / DB Save
under Modell-ID: yes
Modell-ID: Data

PDF upload in ordner ok
but all other data Inputs (titel, vorname, Nachname ...) are missing
---------------------
2. Test
Setup / Files Upload
Array-Felder: dataup,dataup,dataup,dataup,dataup

Setup / DB Save
under Modell-ID: no
Modell-ID: Data

Error: Error: 1054 - Unknown column 'Array' in 'field list'
-----------------
3. Test
Setup / Files Upload
Array-Felder: empty

Setup / DB Save
under Modell-ID: no
Modell-ID: Data

all other data Inputs (titel, vorname, Nachname ...) ok
PDF-Dateien not upload in Ordner
----------------------------
4. Test
Setup / Files Upload
Array-Felder: empty

Setup / DB Save
under Modell-ID: no
Modell-ID: Data
Costume Code:
 <?php 
$form->data['dataup']=implode(', ',$form->data['dataup']);
?> 


Error: Warning: implode(): Invalid arguments passed in...

Fred.
Fredolino 06 Jan, 2016
OK, upload-problem can solved. 😀

In Setup:

Files Upload:
Array-Felder: dataup,dataup,dataup,dataup,dataup

Custom Code:
<?php
$form->data['dataup']=implode(', ',$form->data['dataup']);
?>

DB Save
Unter Modell-ID: nein
Modell-ID: Data

Thanx
Fred.
Fredolino 06 Jan, 2016
Hi,
One last question:
If every single file to be displayed as a link in CC5 in "view", then something must be inserted somewhere in the script.

In Setup /Custom Code?
or
In CC5 "view"?

<a href='{$form->files['dataup']['link']}' >{$form->files['dataup']['name']}</a>
<a href='{$form->files['dataup']['link']}' >{Resume.dataup}</a>

The link includes all the files total. And when I click on the link then comes the message: "Connection's name not present!"

Fred.
Fredolino 07 Jan, 2016
Hi,
I think something like that would have the array in CC5 "view" display:
 <?php echo "<a href =" {$form->files['dataup'] ['link']} "> {$form->files['dataup'] ['name']} </a> "; ?> 

but I get an error message:
Parse error: syntax error, unexpected '{', expecting ',' or ';'

F.
GreyHead 07 Jan, 2016
Hi Fredelino,

There's a problem with quotes- please use single quotes for the href=' . . . '
<?php echo "<a href='{$form->files[dataup][link]}' >{$form->files['dataup']['name']}</a>"; ?> 

Bob
Fredolino 07 Jan, 2016
Hi Bob,
this: {Resume.dataup} show 2 PDFs in "view" (no link)

this:
<td class="tg-yw4l">{Resume.dataup}<br />
<?php echo "<a href='{$form->files[dataup][link]}' >{$form->files['dataup']['name']}</a>"; ?>

denotes nothing...mh...

LG
F.
GreyHead 08 Jan, 2016
Hi Fredolino,

I just noticed that you posted the $_FILES data not the ChronoForms $form->files data.

Please drag a Debugger action into the On Submit event, then submit the form and post the results here.

Bob
Fredolino 08 Jan, 2016
Hi Bob,

this is the result:
GreyHead 08 Jan, 2016
Hi Fredolino,

I still think that is $_FILES and not the ChronoForms debugger output ???

Bob
Fredolino 08 Jan, 2016
Upps.... just.... 🙄
GreyHead 09 Jan, 2016
Hi Fredolino,

It looks to me as though the file names are being saved into the database correctly now?

Bob
Fredolino 15 Jan, 2016
Hi Bob,

was a few days not in the office.
Yes, the PDF files are now stored separately.
What I still can not do now, is to link these files individually.
Your proposal was:
<?php echo "<a href='{$form->files[dataup][link]}' >{$form->files['dataup']['name']}</a>"; ?> 

So I did it in CC5 "View":
td class="tg-yw4l">{Resume.dataup}  <-- displays PDFs, but not linked<br />
<?php echo "<a href='{$form->files[dataup][link]}' >{$form->files['dataup']['name']}</a>"; ?> <-- denotes nothing</td>


LG
Fred.
GreyHead 15 Jan, 2016
Hi Fredolino,

If you temporarily turn on the CC Debugger you will see the data that is being loaded. $form->files is only used by ChronoForms when the file is being uploaded. In CC it will use the same format as other row data.

Bob
Fredolino 15 Jan, 2016
Hi Bob,
:? ..i must Code in CF5 "Setup" change?
GreyHead 16 Jan, 2016
Hi Fredolino,

Neither of those look right to me - but I have no idea what data you have where or what you are trying to do here.

Why do you need to change the Files UPload settings?

Bob
Fredolino 16 Jan, 2016
Hi Bob,

these are the settings on the setup from the CF-form.
Thus, the PDF file names are stored in the database and the PDFs stored in the default folder.
So I can view these uploaded PDF files, these should be linked separately. The PDF links will be clicked here in CC5 "View".
Unfortunately I did not make the link can self.
I thought that someone could help.

Best regards
F.
GreyHead 17 Jan, 2016
HI Fredolino,

So, we are in ChronoForms and the data is in $form->data['dataup'] and you need to create two links from it.

In a Custom Code element in the Designer tab add code like this:
<?php
$dataup = explode(',', $form->data['dataup']);
$folder = 'some/folder/path/';
$url = JURI::root().$folder;
foreach ( $dataup as $d ) {
  echo "<p><a href='{$url}{$d}'>$d</a></p>";
}
?>

Bob
Fredolino 17 Jan, 2016
Hi Bob,
I think only a small error still ...

LG
Fred.
GreyHead 17 Jan, 2016
Hi Fredolino,

I missed a ) - fixed now.

Bob
Fredolino 17 Jan, 2016
Hi Bob
thank you. The error message no longer occurs in the frontend.
The PDF files are but still not linked.
I have CF in a Multi Field in designer created with File-Field and Custom with the Code.
Something's wrong.
Maybe I need to enter something in the view code CC5.

LG
Fred.
Fredolino 21 Jan, 2016
Hi,
now I'm a little further with my form.
With this custom code that uploads the CF5 Form Photo is displayed to me in my edit form:

<?php
if (isset($form->data ['Resume'] ['foto']) && $form->data ['Resume'] ['foto']) {
 echo "<img src='/components/com_chronoforms5/chronoforms/uploads/Bewerbungen/{$form->data['Resume'] ['foto']}' style='max-width:200px' />";
} else {
 echo "<img src='".JURI::root()."components/com_chronoforms5/chronoforms/uploads/Bewerbungen/no_image.jpg' style='max-width:150px' />";
}
?>
 


So I can delete or replace the picture, I have created a checkbox group.
Field Name: delete_image
Option: delete =Löschen
Enable ghost: Yes
Ghost value: Löschen

In Setup ein Custom Code:

  
<?php
if  ( isset($form->data['delete_image']) && $form->data['delete_image'] == 'Löschen' ) {
 $form->data[Resume]['foto'] = '';
}
?>


The status is:
I can delete the image in my Edit form. After deleting is my "no_image.jpg" appears.
That is correct

To upload a new image that "no_image.jpg" replaced again, I have in a Designer "FileUpload field"
Field Name: Resume [foto]
Unfortunately, this does not. Probably because the Edit form on CC5 runs.
Text fields can be changed already. Only the picture I can not change.

Do I have to have a Custom Code Register?

LG
F.
GreyHead 24 Jan, 2016
Hi Fredolino,

I suspect that the CC Save action may not support a file upload. If that is correct then you can call the form directly from an Edit link in CC, run the normal form Submit action including the Files Upload, then redirect to the CC listing when the submission is complete.

Bob
Fredolino 24 Jan, 2016
Hi Bob,

Excuse me, I have now solved the problem itself.
It keen that the form has the images not stored in the default directory in a folder named by CC5.
I had to change the upload path in the action and i






Hi Bob,

Excuse me, I have now solved the problem itself.
It keen that the form has the images not stored in the default directory in a folder named by CC5.
I had to change the upload path in the action and i




Hi Bob,

Excuse me, I have now solved the problem itself.
It keen that the form has the images not stored in the default directory in a folder named by CC5.
I had to change the upload path in the action and i

 <?php
if($form->data("foto")){
$form->data["Resume"]["foto"] = $form->data["foto"];
}


Thanks a lot for your help!

F.
This topic is locked and no more replies can be posted.