Getting empty on file upload

Hi all,
I am using struts1.1 and iam trying to upload the files.
when iam trying to get FileItem list using
List fileItemsList = fileUpload.parseRequest(request); i am gtting empty list can any body please help me
here i am attaching the code in action file and form
if(FileUpload.isMultipartContent(request)){
System.out.println("form filename************ from action");
FileUpload fileUpload=new FileUpload();
List fileItemsList = fileUpload.parseRequest(request);
String optionalFileName = "";
FileItem fileItem = null;
Iterator iterator = fileItemsList.iterator();
while(iterator.hasNext())
FileItem fileItemTemp = (FileItem)iterator.next();
if (fileItemTemp.isFormField())
String filedName=fileItemTemp.getFieldName();
String fieldValue=fileItemTemp.getString();
System.out.println("fieldName is"+filedName);
System.out.println("fieldValue is"+fieldValue);
if (fileItemTemp.getFieldName().equals("filename"))
optionalFileName = fileItemTemp.getString();
else
fileItem = fileItemTemp;
if (fileItem!=null){
String fileName = fileItem.getName();
System.out.println("fileName from file item is"+fileName);
String contentType=fileItem.getContentType();
String fieldName=fileItem.getFieldName();
long fileSize=fileItem.getSize();
if (fileItem.getSize() > 0){
if (optionalFileName.trim().equals(""))
fileName = (new File(fileName)).getName();
else
fileName = optionalFileName;
String dirName = "/redserver/fileuploads";
System.out.println("directory name is@@@@@@@@@"+dirName);
File saveTo = new File(dirName + fileName);
fileItem.write(saveTo);
ActionForm code:
/** dpmodel property */
private String dpmodel;
/** iattach property */
private FormFile iattach;
/** rattach property */
private FormFile rattach;
/** tinput property */
private String tinput;
/** fattach property */
private FormFile fattach;
private String dattachment;
* @return Returns the dattachment.
public String getDattachment() {
return dattachment;
* @param dattachment
* The dattachment to set.
public void setDattachment(String dattachment) {
this.dattachment = dattachment;
* Returns the dpmodel.
* @return String
public String getDpmodel() {
return dpmodel;
* @return Returns the fattach.
public FormFile getFattach() {
return fattach;
* @param fattach The fattach to set.
public void setFattach(FormFile fattach) {
System.out.println("fileattachment*** from ActionForm"+fattach);
this.fattach = fattach;
* @return Returns the iattach.
public FormFile getIattach() {
return iattach;
* @param iattach The iattach to set.
public void setIattach(FormFile iattach) {
System.out.println("imageattachment*** from ActionForm"+iattach);
this.iattach = iattach;
* @return Returns the rattach.
public FormFile getRattach() {
return rattach;
* @param rattach The rattach to set.
public void setRattach(FormFile rattach) {
System.out.println("refmodelachment*** from ActionForm"+rattach);
this.rattach = rattach;
* @param dpmodel The dpmodel to set.
public void setDpmodel(String dpmodel) {
this.dpmodel = dpmodel;
* Returns the tinput.
* @return String
public String getTinput() {
return tinput;
* Set the tinput.
* @param tinput
* The tinput to set
public void setTinput(String tinput) {
this.tinput = tinput;
and my jsp is
<html:form action="uploadAction" name="CustomerRequirementsForm" type="com.customer.webinterface.actionform.CustomerRequirementsForm" method="post" scope="request" enctype="multipart/form-data">
<tr>
<td><div align="right">Attach File : </div></td>
<td> <input type=file name="fattach" value="Browse"></td>
</tr>
<tr>
<td><div align="right">
<p><span class="bodytext">Attach Image</span> : </p>
</div></td>
<td><input type="file" name="iattach" value="Browse"></td>
</tr>
<tr>
<td><div align="right">
<p><span class="bodytext">Reference Models</span> : </p>
</div></td>
<td><input type="file" name="rattach" value="Browse"></td>
</tr>
</html:form
thanx

Hi all,
I am using struts1.1 and iam trying to upload the files.
when iam trying to get FileItem list using
List fileItemsList = fileUpload.parseRequest(request); i am gtting empty list can any body please help me
here i am attaching the code in action file and form
if(FileUpload.isMultipartContent(request)){
System.out.println("form filename************ from action");
FileUpload fileUpload=new FileUpload();
List fileItemsList = fileUpload.parseRequest(request);
String optionalFileName = "";
FileItem fileItem = null;
Iterator iterator = fileItemsList.iterator();
while(iterator.hasNext())
FileItem fileItemTemp = (FileItem)iterator.next();
if (fileItemTemp.isFormField())
String filedName=fileItemTemp.getFieldName();
String fieldValue=fileItemTemp.getString();
System.out.println("fieldName is"+filedName);
System.out.println("fieldValue is"+fieldValue);
if (fileItemTemp.getFieldName().equals("filename"))
optionalFileName = fileItemTemp.getString();
else
fileItem = fileItemTemp;
if (fileItem!=null){
String fileName = fileItem.getName();
System.out.println("fileName from file item is"+fileName);
String contentType=fileItem.getContentType();
String fieldName=fileItem.getFieldName();
long fileSize=fileItem.getSize();
if (fileItem.getSize() > 0){
if (optionalFileName.trim().equals(""))
fileName = (new File(fileName)).getName();
else
fileName = optionalFileName;
String dirName = "/redserver/fileuploads";
System.out.println("directory name is@@@@@@@@@"+dirName);
File saveTo = new File(dirName + fileName);
fileItem.write(saveTo);
ActionForm code:
/** dpmodel property */
private String dpmodel;
/** iattach property */
private FormFile iattach;
/** rattach property */
private FormFile rattach;
/** tinput property */
private String tinput;
/** fattach property */
private FormFile fattach;
private String dattachment;
* @return Returns the dattachment.
public String getDattachment() {
return dattachment;
* @param dattachment
* The dattachment to set.
public void setDattachment(String dattachment) {
this.dattachment = dattachment;
* Returns the dpmodel.
* @return String
public String getDpmodel() {
return dpmodel;
* @return Returns the fattach.
public FormFile getFattach() {
return fattach;
* @param fattach The fattach to set.
public void setFattach(FormFile fattach) {
System.out.println("fileattachment*** from ActionForm"+fattach);
this.fattach = fattach;
* @return Returns the iattach.
public FormFile getIattach() {
return iattach;
* @param iattach The iattach to set.
public void setIattach(FormFile iattach) {
System.out.println("imageattachment*** from ActionForm"+iattach);
this.iattach = iattach;
* @return Returns the rattach.
public FormFile getRattach() {
return rattach;
* @param rattach The rattach to set.
public void setRattach(FormFile rattach) {
System.out.println("refmodelachment*** from ActionForm"+rattach);
this.rattach = rattach;
* @param dpmodel The dpmodel to set.
public void setDpmodel(String dpmodel) {
this.dpmodel = dpmodel;
* Returns the tinput.
* @return String
public String getTinput() {
return tinput;
* Set the tinput.
* @param tinput
* The tinput to set
public void setTinput(String tinput) {
this.tinput = tinput;
and my jsp is
<html:form action="uploadAction" name="CustomerRequirementsForm" type="com.customer.webinterface.actionform.CustomerRequirementsForm" method="post" scope="request" enctype="multipart/form-data">
<tr>
<td><div align="right">Attach File : </div></td>
<td> <input type=file name="fattach" value="Browse"></td>
</tr>
<tr>
<td><div align="right">
<p><span class="bodytext">Attach Image</span> : </p>
</div></td>
<td><input type="file" name="iattach" value="Browse"></td>
</tr>
<tr>
<td><div align="right">
<p><span class="bodytext">Reference Models</span> : </p>
</div></td>
<td><input type="file" name="rattach" value="Browse"></td>
</tr>
</html:form
thanx

Similar Messages

  • Getting empty log files with log4j and WebLogic 10.0

    Hi!
    I get empty log files with log4j 1.2.13 and WebLogic 10.0. If I don't run the application in the application server, then the logging works fine.
    The properties file is located in a jar in the LIB folder of the deployed project. If I change the name of the log file name in the properties file, it just creates a new empty file.
    What could be wrong?
    Thanks!

    I assume that when you change the name of the expected log file in the properties file, the new empty file is that name, correct?
    That means you're at least getting that properties file loaded by log4j, which is a good sign.
    As the file ends up empty, it appears that no logger statements are being executed at a debug level high enough for the current debug level. Can you throw in a logger.error() call at a point you're certain is executed?

  • Getting "Warning: The file upload failed.No such file or directory." while trying to upload image using af:inputFile

    Hi,
    I have a <af:inputFile> component which will upload only image file and render  the corresponding image...
    It work with normal application deployed on weblogic server however when i use same taskflow as a part of human task in SOA BPM worklist...
    I get this warning message "Warning: The file upload failed.No such file or directory." for certain files where as it works for certain image files.
    And in BPM whenever i upload PNG file it throws this error.
    Please help.

    For some files like Images with .png extensions it gives following error :
    java.io.IOException: No such file or directory
      at java.io.UnixFileSystem.createFileExclusively(Native Method)
      at java.io.File.checkAndCreate(File.java:1705)
      at java.io.File.createTempFile0(File.java:1726)
      at java.io.File.createTempFile(File.java:1803)
      at org.apache.myfaces.trinidadinternal.config.upload.UploadedFileImpl._createOutputStream(UploadedFileImpl.java:284)
      at org.apache.myfaces.trinidadinternal.config.upload.UploadedFileImpl.loadFile(UploadedFileImpl.java:208)
      at org.apache.myfaces.trinidadinternal.config.upload.CompositeUploadedFileProcessorImpl._processFile(CompositeUploadedFileProcessorImpl.java:344)
      at org.apache.myfaces.trinidadinternal.config.upload.CompositeUploadedFileProcessorImpl.processFile(CompositeUploadedFileProcessorImpl.java:95)
      at org.apache.myfaces.trinidadinternal.config.upload.FileUploadConfiguratorImpl._doUploadFile(FileUploadConfiguratorImpl.java:329)
      at org.apache.myfaces.trinidadinternal.config.upload.FileUploadConfiguratorImpl.beginRequest(FileUploadConfiguratorImpl.java:162)
      at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl._startConfiguratorServiceRequest(GlobalConfiguratorImpl.java:610)
      at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.beginRequest(GlobalConfiguratorImpl.java:216)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:155)
      at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.bpel.services.workflow.client.worklist.util.WorkflowFilter.doFilter(WorkflowFilter.java:175)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.bpel.services.workflow.client.worklist.util.DisableUrlSessionFilter.doFilter(DisableUrlSessionFilter.java:70)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
      at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
      at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
      at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
      at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
      at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

  • Getting error while file uploading in struts

    Hi!
    I am getting this error while file uploading,I can't find any solution.
    SRVE0026E: [Servlet Error]-[org.apache.commons.fileupload.FileUpload: method setSizeMax&#40;I&#41;V not found]: javax.servlet.ServletException: org.apache.commons.fileupload.FileUpload: method setSizeMax(I)V not found
         at com.honeywell.sdm.base.controller.SDMActionServlet.service(SDMActionServlet.java:75)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
         at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
         at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
         at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
         at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
         at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
         at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
         at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
         at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
         at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
         at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
         at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:116)
         at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
         at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
         at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
         at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
         at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
         at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)
    Please help me.I have attached the bean,action ,jsp pages
    uploadInfo.jsp
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <html:html>
    <HEAD>
    <script>
    function submitting(){
    document.uploadForm.operation.value = "uploadOrgAdj";
    document.uploadForm.action = "/uploadRecAction.do";
    document.uploadForm.submit();
    </script>
    </HEAD>
    <body>
    <html:form action="/uploadRecAction" method="post" enctype="multipart/form-data">
    <b>Select the .xls File to upload data </b>
    <html:file property="fileName"></html:file>
    <html:hidden property="operation" value=""/>
    <html:button property="btn" value="Submit" onclick="submitting()"></html:button>
    </html:form>
    </body>
    </html:html>
    uploadAdjForm :
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionError;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.upload.FormFile;
    public class uploadAdjForm extends ActionForm{
         private FormFile fileName;
              * @return
              public FormFile getFileName() {
                   System.out.println("getFileName"+fileName);
                   return fileName;
              * @param string
              public void setFileName(FormFile string) {
                   System.out.println("setileNmame"+string);
                   fileName = string;
    Action:
    public class uploadFinancialAdjAction extends DispatchAction{     
         public org.apache.struts.action.ActionForward uploadOrgAdj(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception {
              String sForward = "UploadInfo";               
              HttpSession session = request.getSession();          
              String sStartIndex = null;
              String sEndIndex = null;
    try
         uploadFinancialAdjForm UploadForm=(uploadFinancialAdjForm)form;
         System.out.println(UploadForm.getFileName().getContentType().toString());
         String file=UploadForm.getFileName().toString();     
    uploadFinancialAdjManager businessManager = new uploadFinancialAdjManager();
         ArrayList fileName = new ArrayList();                                   fileName = businessManager.getOrgAdjDetails(file);
              boolean isMultipart = FileUpload.isMultipartContent(request);
              if(isMultipart){
              // Create a new file upload handler
              DiskFileUpload upload = new DiskFileUpload();
              // Parse the request
              List items = upload.parseRequest(request);
              //Process the uploaded items
              Iterator iter = items.iterator();
              while (iter.hasNext()) {
                   FileItem item = (FileItem) iter.next();
                   if (item.isFormField()) {          
              //processFormField(item);
              if(item.getFieldName().equalsIgnoreCase("txtStartIndex")){          
                   sStartIndex = item.getString();          
              else if(item.getFieldName().equalsIgnoreCase("txtEndIndex")){
                             sEndIndex = item.getString();          
    uploadFinancialAdjForm UploadForm=(uploadFinancialAdjForm)form;
                             String file=UploadForm.getFileName().toString();               
              uploadFinancialAdjManager businessManager = new uploadFinancialAdjManager();
                             ArrayList fileName = new ArrayList();
                             fileName = businessManager.getOrgAdjDetails(file);
              }else{
                   if(item.getName()!=null && !item.getName().toUpperCase().endsWith(".XLS")){
              throw new Exception("Please browse an excel file and Upload");
              session.setAttribute("fileItem",item);
              }//end of while
              session.setAttribute("startIndex",sStartIndex);
              session.setAttribute("endIndex",sEndIndex);
              request.setAttribute("FileUploadStatus","true");
              else{
              throw new Exception("Error:Form is not multipart");
    catch(Exception e)
         System.out.println(e);
         return mapping.findForward(sForward);
    }

    ORA-06512: at "PREPRD.OIM_SP_RECONARCHIVAL", line 722
    ORA-00942: table or view does not exist
    ORA-01031: insufficient privileges
    (1) Check whether the OIM_SP_RECONARCHIVAL table or view exists or not...
    (2) If it exists, check whether the DEV_OIM user has enough privilege to view this table or not...
    If not, give it all privilege by login as sys as sysdba
    GRANT ALL PRIVILEGES TO DEV_OIM;
    COMMIT;

  • Getting empty csv file using servlet

    Hi
    i am working on reports for my web application and i used struts frame work.
    for my reports i want csv export, so for that i written servlet, once if i click generate button i am able to open popup window to save the generated csv file at my local system, but i am getting emplty csv file..
    nothing si ther ein that file forget abt data atleast my header fields.
    here is my servlet file..plz let me know where i am doing wrong..
    public class ReportServlet extends HttpServlet{
         public void doPost(HttpServletRequest req,HttpServletResponse res)
    throws ServletException,IOException
    PrintWriter out = res.getWriter();
    res.setContentType("text/csv");
    res.setHeader("Content-Disposition","attachment; filename=\"export.csv\"");
    out = res.getWriter();
    AdvDetailReportBean reportBean = null;
    ArrayList list =(ArrayList)req.getSession().getAttribute("advreportlist");
    System.out.println(" servlet report list size is"+list.size());
    String branchcode=(String)req.getSession().getAttribute("branchcode");
              String bName=(String)req.getSession().getAttribute("branchname");
              System.out.println(" servlet branch name"+bName);
              System.out.println(" servlet branch code"+branchcode);
    StringBuffer fw = new StringBuffer();
              fw.append("Branch Code");
              fw.append(',');
              fw.append("Branch Name");
              fw.append('\n');
              fw.append(branchcode);
              fw.append(',');
              fw.append(bName);
              fw.append('\n');                              
              fw.append('\n');
              fw.append("Customer Name");
         fw.append(',');
         fw.append("Constitution Code");
         fw.append(',');
         fw.append("Customer Status");
         fw.append(',');
         fw.append("Restructure Date");
         fw.append(',');
         fw.append("Total Provision");
         fw.append(',');
         fw.append("Limit Sanctioned");
         fw.append(',');
         fw.append("Principal");
         fw.append(',');
         fw.append("Balance");
         fw.append(',');
         fw.append("AccountID");
         fw.append(',');
         fw.append("Collateral SL No");
         fw.append(',');
         fw.append("Issue Date Of Collateral");
         fw.append(',');
         fw.append("MaturityDate Of Collateral");
         fw.append(',');
         fw.append("Subsidy");
         fw.append(',');
         fw.append("Guarantor SL No");
         fw.append(',');
         fw.append("Guarantor Rating Agency ");
         fw.append(',');
         fw.append("External Rating of Guarantor");
         fw.append(',');
         fw.append("Rating Expiry Date");
         fw.append(',');
         fw.append("Guarantee Amount");
         fw.append(',');
         fw.append('\n');
         for (Iterator it = list.iterator(); it.hasNext(); )
              reportBean = new AdvDetailReportBean();
              reportBean = (AdvDetailReportBean)it.next();
              fw.append(reportBean.getCustomername());
              fw.append(',');
              fw.append(reportBean.getConstitutionCode());
              fw.append(',');
              fw.append(reportBean.getCustomerStatus());
              fw.append(',');
              fw.append(reportBean.getRestructureDate());
         fw.append(',');
         fw.append(reportBean.getTotalProvision());
         fw.append(',');
         fw.append(reportBean.getLimitSanctioned());
         fw.append(',');
         fw.append(reportBean.getPrincipal());
         fw.append(',');
         fw.append(reportBean.getBalance());
         fw.append(',');
         fw.append(reportBean.getCurrentValue());
         fw.append(',');
         fw.append(reportBean.getAccountNumber());
         fw.append(',');
         fw.append(reportBean.getColCRMSecId());
         fw.append(',');
         fw.append(reportBean.getIssueDt());
         fw.append(',');
         fw.append(reportBean.getMarturityDt());
         fw.append(',');
         fw.append(reportBean.getUnAdjSubSidy());
         fw.append(',');
         fw.append(reportBean.getGuarantorFacilityId());
         fw.append(',');
         fw.append(reportBean.getRatingAgency());
         fw.append(',');
         fw.append(reportBean.getExternalRating());
         fw.append(',');
         fw.append(reportBean.getExpDtOfRating());
         fw.append(',');
         fw.append(reportBean.getGuaranteeAmt());
         fw.append(',');
         fw.append('\n');
    }

    You don't seem to be writing anything to the response at all. Yes, you create a StringBuffer and write lots of stuff to the StringBuffer but then you do nothing else with that buffer.

  • To get content of file upload element in web dynpro

    Hi . . .
    h1 : how can i get the string content   (i.e., path of file) store in variable in web dynpro abap . . . .

    Hi . . .
    h1 : how can i get the string content   (i.e., path of file) store in variable in web dynpro abap . . . .

  • Keep Getting Annoying Image/File Upload Error Please Help!

    I keep getting this error message - can't upload image X.png, it seems to happen with several different image - then I try to resume/retry wait some time; sometimes it works and sometimes it doesn't, getting kind of frustrating.  Please help!
    http://chefagogo.businesscatalyst.com/

    Hi
    Are you still facing the same issue ?
    It can be due to few reasons such as connectivity issues or if any update to your site is done at the same time from BC end.
    If still you are facing same error, please let me know.
    Thanks,
    Sanjit

  • File upload problem. Can't write to server

    Hi guys,
    I am currently trying to upload some images to the server I am using but I can't succeed.
    I am using a form consisting of 3 text fields 1 textarea and an upload form.
    The whole thing is working fine on my localhost . All the items are being inserted to the database and the files saved to the path.
    But when I try to upload to the commercial server even though the text field are being read and inserted to database the files just can't!!
    my tree structure is
    /home/domain/www-domain/webapps
    and that's what I am getting when using
    getServletContext().getRealPaththe full line for getting the real path is
    FileWriter fw2 = new FileWriter(getServletContext().getRealPath("//upload"+fileName+".jsp")); I am using tomcat 4.0 and all the other servlets are working just fine
    as this one apart from the FileWriting thing?
    am I doing something wrong with the getServletContext thing?
    And if so, why is it working just fine on my pc?
    I am only suspecting that I am not getting the path correctly
    I want to store the images under
    webapps/upload/images
    but it doesn't work even when I am trying to store under webapps (root directory)
    Is there any way that I am not getting permission to write to the server??
    Any help is highly appreciated!!
    cheers

    the thing is that I am not getting any exception back to my browser> some of the values are inserted into the database (the ones that are not referring to any uploded items). i guess i have to do a print.stacktrace but I am not sure at which point...
    ok I am posting the full code to give you an idea. Your interest is much appreciated , thank you
    import java.sql.*;
    import java.text.ParsePosition;
    import java.text.SimpleDateFormat;
    import java.util.*;
    import java.util.Date;
    import gr.cretasport.util.*;
    import org.apache.commons.fileupload.*;
    import java.awt.Image;
    import java.io.*;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest ;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    * @author myron.veligradis
    * 17/09/2005
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    public class InsertArticle extends HttpServlet{
      * global variables
    String fieldName;
    Image imageIn;
    Resize rsImg = new Resize();
    Mirror mrImg = new Mirror();
    //ImageProcess ImPr = new ImageProcess();
    Date curDate;
    String datecur;
    String inputtext;
    BufferedWriter bw;
    String aRString ;
    String photoPath;
    File savedFile;
    String txtPath;
    String txtPathFullText;
    String author;
    String eidos;
    String kathgoriaID;
    String title;
    String rating;
    String kathgoria;
    String keimeno;
    String keimenoRest;
    String fullKeimeno;
    String hmeromhniaD;
    final String jspPrefix="<%@ page contentType=\"text/html; charset=iso-8859-7\" language=\"java\"  errorPage=\"\" %>";
    Connection con=null;
    Statement statement = null;
    ResultSet rs, rs1 = null;
    int kathgoriaIDInt;
    int ratingInt;
    public void init(ServletConfig conf) throws ServletException  {
      super.init(conf);
    public void doPost (HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException, UnsupportedEncodingException {
    //  try {
    //   req.setCharacterEncoding("iso-8859-7");
    //   catch (UnsupportedEncodingException uee)
      boolean isMultipart = FileUpload.isMultipartContent(req);
      HttpSession session = req.getSession();
      ServletContext sc = getServletContext();
       * GET THE FILE NAME
      curDate=new Date();
      datecur = curDate.toString ();
        String fileName = datecur.replaceAll("\\W","_");
        String strDate = curDate.toString();
        SimpleDateFormat formatter= new SimpleDateFormat ("EEE MMM dd hh:mm:ss zzz yyyy");
      Date date = formatter.parse(strDate,new ParsePosition(0));
      hmeromhniaD = new SimpleDateFormat("yyyy-MM-dd").format(date);
       *  GET THE PARAMETERS
       *  FILE UPLOAD *******************************************************
      System.out.println(isMultipart);
      DiskFileUpload upload = new DiskFileUpload();
      try {
       req.setCharacterEncoding("iso-8859-7");
       List items = upload.parseRequest(req);
       Iterator itr = items.iterator();
       while(itr.hasNext()) {
        FileItem item = (FileItem) itr.next();
    //    String articleTitle = new String(req.getParameter("articleTitle").getBytes("iso-8859-1"),"iso-8859-7");
       // check if the current item is a form field or an uploaded file
         if(item.isFormField()) {
         // get the name of the field
         // if it is name, we can set it in request to thank the user
         if (item.getFieldName().equals("author")) {
                author = new String(item.getString().getBytes("iso-8859-1"),"iso-8859-7");
         if (item.getFieldName().equals("eidos")) {
                eidos = new String( item.getString().getBytes("iso-8859-1"),"iso-8859-7");
         if (item.getFieldName().equals("keimeno")) {
                keimeno =item.getString();
                FileWriter fw1 = new FileWriter(getServletContext().getRealPath("webapps//upload"+"pro_"+fileName +".jsp"));
           fw1.write(jspPrefix+"<html><body>"+keimeno+"</body></html>");
           fw1.close();
           txtPath = ("upload/text/"+"pro_"+fileName+".jsp");
         if (item.getFieldName().equals("keimenorest")) {
                keimenoRest =item.getString();
                FileWriter fw2 = new FileWriter(getServletContext().getRealPath("//upload"+fileName+".jsp"));
           fw2.write(jspPrefix+"<html><body>"+keimeno+" "+keimenoRest+"</body></html>");
           fw2.close();
           txtPathFullText = ("upload/text/fulltext/"+fileName+".jsp");
         if (item.getFieldName().equals("title")) {
               // title = new String(item.getString().getBytes("iso-8859-1"),"iso-8859-7");
                System.out.println ("titlos "+title);
                title=getServletContext().getRealPath("webapps//upload");
         if (item.getFieldName().equals("rating")) {
                rating = item.getString();
         if (item.getFieldName().equals("kathgoriaID")) {
                kathgoriaID = item.getString();
       else {
        // the item must be an uploaded file save it to disk. Note that there
        // seems to be a bug in item.getName() as it returns the full path on
        // the client's machine for the uploaded file name, instead of the file
        // name only. To overcome that, I have used a workaround using
        // fullFile.getName().
        File fullFile  = new File(item.getName()); 
        //check if input file is actually an image
        if ( item.getName().toLowerCase().endsWith(".jpg") ||
        item.getName().toLowerCase().endsWith(".gif") ||
        item.getName().toLowerCase().endsWith(".bmp"))
         File temp = new File(getServletContext().getRealPath("webapps//upload")," temp.jpg");
         item.write(temp);
         //to class Resize pernei 2 inputs, to file kai to path string
         rsImg.resizeImage(temp,getServletContext().getRealPath("webapps//upload"+fileName+".jpg"));
         //to class Mirror pernei kai ayto 2 inputs, to file poy exei dhmiourgithei apo panw
         //pou to kanei overwrite epeidh pernoun to idio onoma me to time stamp
         Mirror.mirrorImage(new File(getServletContext().getRealPath("webapps"+fileName+".jpg")),
           getServletContext().getRealPath("webapps//upload"+fileName+".jpg"));
         System.out.println("upload/images/"+fileName+".jpg");
      kathgoriaIDInt= new Integer(kathgoriaID).intValue();
      ratingInt   = new Integer(rating).intValue();
       * HTML UPLOAD
      catch (Exception fe) {
      //get the string names to insert to database
      photoPath="upload/images/"+fileName+".jpg";
       * INSERT THE DATA INTO THE DATABASE
      InsertToDatabase();
      String url="/insertarticle.jsp";
      RequestDispatcher rd = sc.getRequestDispatcher(url);
      rd.forward(req,res);
    //res.sendRedirect( res.encodeRedirectURL( "indextest.jsp "));
    public void InsertToDatabase() {
      try {
       con=null;
       statement = con.createStatement();
       String insertprefix = "insert into articles(eidos,photopath,textpath,textpathfull,title,author,dateen,rating, kathgoriaID) VALUES"
         + "('" + eidos.trim() +"','" + photoPath.trim()  + "','"   +
         txtPath + "','" + txtPathFullText + "','" +title + "','"+ author + "','"+ hmeromhniaD + "','"+ ratingInt+ "','"
         +kathgoriaIDInt + "')";
       statement.execute(insertprefix);
       statement.close();
       con.close();
       catch (Exception e)
    }

  • File upload tmp files

    I am finally so close - I think - to getting my combination
    file upload
    and database update script to work. Yay!
    Of course, in the (long) process of testing, many temp files
    were
    created by the upload form, but never transferred. Does PHP
    take of
    deleting them, and if so how does it know when to? In the
    $_FILES array,
    the [tmp_name] is something like /tmp/phpxxxx... I can not
    find any
    files like this, so I assume they are being deleted, right?
    Thanks,
    Harvey

    On Sat, 18 Oct 2008 14:18:15 -0400, eclipsme
    <[email protected]> wrote:
    >Of course, in the (long) process of testing, many temp
    files were
    >created by the upload form, but never transferred. Does
    PHP take of
    >deleting them, and if so how does it know when to?
    Temp files are automatically deleted when the script
    completes
    execution.
    Gary

  • Multiple File Upload - Database

    Hi
    I have tried and I can't work it out. I have a insert record function which enters the data into the database. I have the filepath set to a file field. If I add an "Upload File" function from ADDT it uses the file field to upload the PDF and also adds the file path to the database.
    How do I get the 'Multiple File Upload" to upload the files when I click "Insert Record".
    'Multiple File Upload" adds an upload link which seems to be separate from the 'Insert Form"
    I hope this makes sense to someone
    Cheers
    Laurence

    Hi Laurence,
    'Multiple File Upload" adds an upload link which seems to be separate from the 'Insert Form"
    that´s true, and that´s also the reason why multiple file or image upload triggers IMHO should rather be attached to an "update record" form -- because here´s where the respective record´s primary key has already been stored and can be used as part of the upload transaction
    (e.g. to create a folder named after the primary key), what would be questionable when applied to an insert record form.
    I´m personally always using single file upload with ADDT´s Insert Record forms and relocate the multi upload stuff to Update Record forms -- also as a sort of "safety measure", because one never really knows if e.g. the filesize sum of all uploaded files will or will not exceed the server´s "upload_max_filesize" value and hence might possibly break the upload procedure.
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • "file.txt" does not exist, or file is empty; you cannot upload empty files

    All,
    I am trying to upload a file in Content Management --> Explorere --> 'Public Document' and get the following error "file.txt" does not exist, or file is empty; you cannot upload empty files.
    We have a EP 2004s install.
    Any thoughts would be appreciated.
    SAP Partner

    Try have a look at the following note: 898637: Upload to KM does not work
    <a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_ep_km/~form/handler%7B5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d383938363337%7D">Upload to KM does not work</a>
    The error seems to be related to a problem with writing into the directory for temporary data.

  • Unable to get the filename from file upload UI element

    Hi,
    I added a FileUpload UI element.
    I created an attribute of type resource , assigned to the resource property of the file upload element.
    I created an action button called upload and added the following code.
    try {
           IWDResource resource = wdContext.currentContextElement().getFileupload();
          } catch (Exception e) {
             e.printStackTrace();
    when I debug to see the value of resource it is null.
    Please let me know where I am going wrong.
    Regards,
    Narayani

    Hi,
    Check if there are any space characters in your uploading path (file path).
    First try to upload a file without any space characters in the uploading path(file path). If the problem is with the space characters then use the below encoding & decoding to resolve that issue.
    Encoding while uploading the file:
    // Getting the file resource
    IWDResource resource = element.getCtx_va_FileResource();
    //Getting the resource name
    String resourceName = resource.getResourceName();
    //Encoding the resource name
    String encoderesourceName = java.net.URLEncoder.encode(resourceName,"UTF-8");
    Again while downloading you can use decoder.
    Hope this helps to resolve your issue.
    See this below link.
    Re: File Upload Problem
    Try this encoding even if there are no space characters.
    Regards,
    Charan

  • File does not exist, or file is empty; you cannot upload empty files

    Hello,
    I've a problem when trying to upload any file to KM Repository (Content Administrator-KM Content-Root-documents). It shows the following error: File does not exist, or file is empty; you cannot upload empty files.
    I have applied SAP note 898637 but is still not working. We're using SAP EP 7.0 SP11.
    Please, what could be the problem?
    Thanks in advance,
    Belé

    We've put the Java paremeters in Configtool.bat :
    -Djava.io.tmpdir=c:/EP_TEMP
    -Dcm.tmpdir=c:/EP_TEMP     
    In Server/Instance. Folders: Message Server&BootStrap and in Servers General and in Instances/Server.
    I hope this helps you,
    Regards

  • I get a file upload popup when composing an email using Godaddy webmail. How can I prevent this from happening?

    When I try to compose an email from Godaddy's webmail in the Firefox browser. My steps are as follows:
    -Open Firefox.
    -Log in to Godaddy webmail.
    -I hit the compose button.
    -New window pops up. This is the window that I would compose an email in.
    - Right after the compose window loads, I get another window that pops up. This window says "File Upload" in the upper left corner.
    If I exit that window I can then compose my email, and life is good until I want to compose another email. Then the problem repeats. I have contacted Godaddy support and the problem is not on their end. Also the problem DOES NOT happen when using another browser (Internet Explorer).

    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!

  • How do I get my videos to upload from my sony handy cam when I get the message The following file could not be imported.  The file is in an unrecognized format. I am using a macbook pro version 10.9.3, I have 411 gb free space, it worked before I updated

    How do I get my videos to upload from my sony handy cam when I get the message The following file could not be imported.  The file is in an unrecognized format. I am using a macbook pro version 10.9.3, I have 411 gb free space, it worked before I downloaded the latest update for iphoto.

    You may be able to download and install the update from here: Digital Camera RAW Compatibility 6.01
    If I upgrade to Yosemite will I be forced to go to the new Photos program
    No. After upgrading (and of course make a back up first) you will need to update iPhoto to v9.6.1 (you won't be able to do this prior to upgrading). Here's how:
    Go to the App Store and check out the Purchases List. If iPhoto is there then it will be v9.6.1
    If it is there, then drag your existing iPhoto app (not the library, just the app) to the trash
    Install the App from the App Store.
    Sometimes iPhoto is not visible on the Purchases List. it may be hidden. See this article for details on how to unhide it.
    http://support.apple.com/kb/HT4928
    One question often asked: Will I lose my Photos if I reinstall?
    iPhoto the application and the iPhoto Library are two different parts of the iPhoto programme. So, reinstalling the app should not affect the Library. BUT you should always have a back up before doing this kind of work. Always.
    Photos is v1 of a new app, as yes it's not as mature as iPhoto. It uses a different technology for working with external editors. That requires Adobe to write an extension to let it hook into the new app. Not done yet, neither has anyone else.
    Going forward: iPhoto will run on OS 10.10., but there is no guarantee for subsequent versions of the OS. You might want to factor that into your anger term thinking.

Maybe you are looking for