Fórum

Attachment files in web form

Tomaž Pelc, modificado 14 Anos atrás.

Attachment files in web form

New Member Postagens: 7 Data de Entrada: 22/07/09 Postagens Recentes
Please help.

How to create input field for attachment files in web form.
Just like here in forum where you can attachment some files.

Thanks all!
Dariusz Sawicki, modificado 14 Anos atrás.

RE: Attachment files in web form

Regular Member Postagens: 165 Data de Entrada: 27/03/09 Postagens Recentes
Hi i hope it's help you;


<form name="get" action="<portlet:actionURL ></portlet:actionURL>" method="POST" enctype="multipart/form-data">
<input type="file" name="file_upload">
<input type="submit" id="form_file" name="form_file">
</form>




Dariusz Sawicki
Joffré Carrier, modificado 14 Anos atrás.

RE: Attachment files in web form

Junior Member Postagens: 28 Data de Entrada: 03/06/09 Postagens Recentes
Ok, this idea sounds good but where will you put this ?
thumbnail
Vidya Sagar Padigela, modificado 14 Anos atrás.

RE: Attachment files in web form

Junior Member Postagens: 49 Data de Entrada: 20/05/08 Postagens Recentes
Joffré Carrier:
Ok, this idea sounds good but where will you put this ?



You have to add the above code in web form portlet in the respective JSP page and override it in ext environment.

Thanks,
Vidya Padigela
Joffré Carrier, modificado 14 Anos atrás.

RE: Attachment files in web form

Junior Member Postagens: 28 Data de Entrada: 03/06/09 Postagens Recentes
Hi and thank for the fast answer.
I'm in development mode ( I set the good environment variables in the portal-ext.properties about the css, javascript and templates) but I doubt that it changes something on the portlet development. I'm modifying the web-form portlet (the one it comes with the latest 5.2.3) but I can't see the changes. Usually, you need to change something in the view.jsp file to see something but when I add a test <div>test</div> nothing happens. Do I need something else ?

By the same way, I would like to know what I have to add in the portal-ext.properties file to make the web-form portlet works.

thanks a lot
thumbnail
Vidya Sagar Padigela, modificado 14 Anos atrás.

RE: Attachment files in web form

Junior Member Postagens: 49 Data de Entrada: 20/05/08 Postagens Recentes
I hope you don't need to do any changes in portal-ext.properties file.

If you have the development environment for ext then create the same folder structure of portlet same as like Liferay source in the ext under ext-web environment. Take the view.jsp source of the web form portlet of Liferay source code into the created web form portlet under ext in ext-web environment and try to add the code in the view.jsp and use the ant target deploy-fast to view the changes.

The one I suggested was not an recommended practice because now liferay is suggesting to use Hooks concept under plugin enviromment inorder to do the JSP changes.

Thanks,
Vidya Padigela
thumbnail
Marcus Souza, modificado 14 Anos atrás.

RE: Attachment files in web form

Junior Member Postagens: 58 Data de Entrada: 31/03/09 Postagens Recentes
Hi,

Could you explain more about the "recommended practice"?! i am trying the same thing here and i cant get it to work. Thanks in advance.
Marcus
thumbnail
Vidya Sagar Padigela, modificado 14 Anos atrás.

RE: Attachment files in web form

Junior Member Postagens: 49 Data de Entrada: 20/05/08 Postagens Recentes
Marcus Souza:
Hi,

Could you explain more about the "recommended practice"?! i am trying the same thing here and i cant get it to work. Thanks in advance.
Marcus


Hi Marcus,

Even myself started looking into recommended practice so even I'm not sure about the implementation. I find one interesting blog which gives you some idea on hooks. Please refer this Blog Post hope it should help you and you can also find some wiki articles.

Thanks,
Vidya Padigela
François LE QUEMENER, modificado 14 Anos atrás.

RE: Attachment files in web form

Junior Member Postagens: 48 Data de Entrada: 18/09/09 Postagens Recentes
Dariusz Sawicki:
Hi i hope it's help you;


<form name="get" action="<portlet:actionURL ></portlet:actionURL>" method="POST" enctype="multipart/form-data">
<input type="file" name="file_upload">
<input type="submit" id="form_file" name="form_file">
</form>



Hum that's not very helpfull in fact... As you said, I added a file input to my form. When I send it, the actionRequest then (in WebFormPortlet) does not contain my file, and the validation fails. It seems it is harder to add the support of files in WebForm
thumbnail
Zeeshan Khan, modificado 12 Anos atrás.

RE: Attachment files in web form

Expert Postagens: 349 Data de Entrada: 21/07/11 Postagens Recentes
Hi Everyone !!


after adding this line <aui:input name="file" type="file" /> in the WEBFORM jsp file, i am able to see the field of attaching the document but the problem is when i click the SEND button, everything is coming in my gmail inbox except the attached document.....


thnx !
thumbnail
Nathan Cook, modificado 11 Anos atrás.

RE: Attachment files in web form

New Member Postagens: 2 Data de Entrada: 03/11/11 Postagens Recentes
You will need to edit four different files. view.jsp, edit_field.jsp, WebFormPortlet.java, and ConfigurationActionImpl.java

edit_field.jsp:
<aui:option selected="<%= fieldType.equals(&quot;file&quot;) %>" value="file"><liferay-ui:message key="file" /></aui:option>


view.jsp:
<c:when test="<%= fieldType.equals(&quot;file&quot;) %>">
	<aui:input cssClass="<%= fieldOptional ? &quot;optional&quot; : StringPool.BLANK %>" label="<%= HtmlUtil.escape(fieldLabel) %>" name="<%= fieldName %>" type="file" value="<%= HtmlUtil.escape(fieldValue) %>" wrap="soft" />
</c:when>


ConfigurationActionImpl.java:
boolean isFileUpload = false;

if ("file".equals("fieldType")) {
	isFileUpload = true;
}

preferences.setValue("isFileUpload", String.valueOf(isFileUpload));


WebFormPortlet.java:
UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(actionRequest);
File file = uploadPortletRequest.getFile("file");
thumbnail
SaiMohan Gadamsetty, modificado 10 Anos atrás.

RE: Attachment files in web form

Junior Member Postagens: 92 Data de Entrada: 06/02/13 Postagens Recentes
I Used same instructions as you given, but File Stream is not passing to WebFormPortlet.java: class. I'm getting null value when trying to access the file source. But File name I can able to see in logs. Used UploadPortletRequest to get the file source. Can any one please help me how can we get the file source.

Thanks,

Sai Mohan
Nasir Hussain, modificado 10 Anos atrás.

RE: Attachment files in web form

New Member Postagens: 5 Data de Entrada: 18/03/14 Postagens Recentes
SaiMohan Gadamsetty:
I Used same instructions as you given, but File Stream is not passing to WebFormPortlet.java: class. I'm getting null value when trying to access the file source. But File name I can able to see in logs. Used UploadPortletRequest to get the file source. Can any one please help me how can we get the file source.

Thanks,

Sai Mohan


The form needs to be multipart and the request in the portlet class should be updated to uploadRequest, from this all params need to be get.
thumbnail
SaiMohan Gadamsetty, modificado 10 Anos atrás.

RE: Attachment files in web form

Junior Member Postagens: 92 Data de Entrada: 06/02/13 Postagens Recentes
Thanks Hussian, your suggestion worked to me. Now I can able to do File operations and even I can able to send web form portlet files as Attachments to the email.

Thanks

Sai Mohan
Joseph M. Sentís, modificado 10 Anos atrás.

RE: Attachment files in web form

New Member Postagens: 11 Data de Entrada: 19/04/11 Postagens Recentes
Hello.

Could you share the changes in WebFormPortlet? I use multipart/form-data but can not get the file yet.

Best regards.

SaiMohan Gadamsetty:
Thanks Hussian, your suggestion worked to me. Now I can able to do File operations and even I can able to send web form portlet files as Attachments to the email.

Thanks

Sai Mohan
Wasim Chowdhury, modificado 9 Anos atrás.

RE: Attachment files in web form

New Member Postagens: 2 Data de Entrada: 22/05/14 Postagens Recentes
Sorry ... its not working for me.
In step 3 ConfigurationActionImpl.java, where do i add those lines?
In step 4. WebFormPortlet.java , where do I add that line.
Then, i want to send this file as attachment with the email. How do process that one, any example code?
Its throwing me errors. Its getting NULL when trying to read.

SaiMohan Gadamsetty:
Thanks Hussian, your suggestion worked to me. Now I can able to do File operations and even I can able to send web form portlet files as Attachments to the email.

Thanks

Sai Mohan
Wasim Chowdhury, modificado 9 Anos atrás.

RE: Attachment files in web form

New Member Postagens: 2 Data de Entrada: 22/05/14 Postagens Recentes
Nasir Hussain:
SaiMohan Gadamsetty:
I Used same instructions as you given, but File Stream is not passing to WebFormPortlet.java: class. I'm getting null value when trying to access the file source. But File name I can able to see in logs. Used UploadPortletRequest to get the file source. Can any one please help me how can we get the file source.

Thanks,

Sai Mohan


The form needs to be multipart and the request in the portlet class should be updated to uploadRequest, from this all params need to be get.


Sorry ... its not working for me.
In step 3 ConfigurationActionImpl.java, where do i add those lines?
In step 4. WebFormPortlet.java , where do I add that line.
Then, i want to send this file as attachment with the email. How do process that one, any example code?
Its throwing me errors. Its getting NULL when trying to read.
Luis Silva, modificado 9 Anos atrás.

RE: Attachment files in web form

Junior Member Postagens: 42 Data de Entrada: 18/04/13 Postagens Recentes
Hi,

I'm using Liferay 6.2, can I use this solution?
Anyone had this working?

Regards,
Luis Silva
thumbnail
Ahmed Sekka, modificado 9 Anos atrás.

RE: Attachment files in web form

Junior Member Postagens: 26 Data de Entrada: 31/03/14 Postagens Recentes
You can do that using EditFileEntryAction . So you directly find the url of portlet which use EditFileEntryActionemoticon:
Luis Silva, modificado 9 Anos atrás.

RE: Attachment files in web form

Junior Member Postagens: 42 Data de Entrada: 18/04/13 Postagens Recentes
Ahmed,
thanks for the suggestion, I'm going to check what I can do it that.
But main goal is not having the attachments on the server but to send them by mail.
I used Nathan code and the file option is available on the form, and it "reads" the file. Reads the value, its missing the upload to the server and after how can I pass this information to WebFormPortlet.java? (and delete it after...) I hardcoded a file from the server and managed to send it in the mail.

Regards,
Luis Silva
thumbnail
Filippo Maria Del Prete, modificado 9 Anos atrás.

RE: Attachment files in web form

New Member Postagens: 8 Data de Entrada: 08/03/12 Postagens Recentes
Hi, I recently worked on a modifed version of the standard web form portlet.

You have file upload, mail notification with attached file, "thank you" email for registered user.

You can find here https://github.com/fdelprete/web-form-fu-portlet the source code.
Sajeesh Ramachandran, modificado 8 Anos atrás.

RE: Attachment files in web form

New Member Postagens: 2 Data de Entrada: 20/11/15 Postagens Recentes
Hi Filippo,

Tried your web form, but after that the webform become unavailable. How to use your web form.
I tried using the link to update the plugin. It shows me after to redeploy which am unable to. Please help

regards
Sajeesh