| Author |
Could not find a Content-Type for upload in struts2
|
sridhar gandikota
Ranch Hand
Joined: Jul 09, 2008
Posts: 31
|
|
Hi Ranchers, I am not able to get the contents for the csv file but for other files its working fine. The code is <s:form action="doUpload" method="POST" enctype="multipart/form-data"> <tr> <td colspan="2"><h1>File Upload Example</h1></td> </tr> <s:file name="upload" label="File"/> <s:textfield name="caption" label="Caption"/> <s:submit /> </s:form> --------------------------------------------------------------------------- in Struts.xml i have placed the below code <action name="upload" method="upload" class="UploadAction" > <result name="success">/pages/uploadsuccess.jsp</result> </action> --------------------------------------------------------------------------- uploadsuccess.jsp has <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="s" uri="/struts-tags" %> <html> <head> <title>Showcase</title> </head> <body> <table class="wwFormTable"> <tr> <td colspan="2"><h1>File Upload Example</h1></td> </tr> <tr> <td class="tdLabel"><label for="doUpload_upload" class="label">File:</label></td> <td><s roperty value="upload" /></td> </tr> </table> </body> </html> Can you please tell me how to upload a csv file. I badly need this to be solved. So please help out
|
 |
Nishan Patel
Ranch Hand
Joined: Sep 07, 2008
Posts: 676
|
|
Hi. Please make sure you put this code in Struts.xml file or not. <interceptor-stack name="fileUploadStack"> <interceptor-ref name="fileUpload"/> <interceptor-ref name="basicStack"/> </interceptor-stack> Thanks, Nishan Patel.
|
Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
|
 |
sridhar gandikota
Ranch Hand
Joined: Jul 09, 2008
Posts: 31
|
|
I have included and tried but still the same. It works for other type of files like xml,txt,zip formats. and it says "Could not find a Content-Type for upload"
|
 |
sridhar gandikota
Ranch Hand
Joined: Jul 09, 2008
Posts: 31
|
|
|
sorry i mean to say "Could not find a Content-Type for upload" for csv files only not for other files
|
 |
 |
|
|
subject: Could not find a Content-Type for upload in struts2
|
|
|