• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Could not find a Content-Type for upload in struts2

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
sridhar gandikota
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry i mean to say "Could not find a Content-Type for upload" for csv files only not for other files
 
You will always be treated with dignity. Now, strip naked, get on the probulator and hold this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic