Urgent!doubt in upload the file to a particular directory.

Hi
Actually i'm developing a site using JSP.
Main concept of the project is the user should be
able to access his files or dabases from anywhere
in the world thru internet via intranet.
i've placed upload option in my site.
each user should b given a separate directory.
can anyone tell me how to make the user to store
the file in a particular directory(the one alloted to him).
And to view the file, if the user enters the file name
it should open the file in the particular format.
i need the coding since i'm new to jsp.
can anyone help me or refer any site tht can solve
my problem?
thanx in advance.

I'd just answered a similar case. I believe this is what you are looking for;
<%@ page contentType="MIME-Type; Charset=Character-Set" %>
Read up on MIME-Type and Character-Set for info.
Here some exmaple;
By default:
<%@ page contentType="text.html; Charset=ISO-8859-1" %>
Show an MS Excel file;
<%@ page contentType="application/vnd.ms-excel" %>
or
<%
String mimeType = "application/vnd.ms-excel"
response.seContentType(mimeType);
%>
Cheers

Similar Messages

  • Error while uploading the file from Allpcation server in LSMW-7th step

    Hi Experts,
    what should be the specific CODE PAGE should be maintained while uploading the file from application server in LSMW-7th Step
    Thanks in advance,
    KSR

    Hi
    I mean that there is any seperate CODE PAGE which comes at the bottom of screen while uploading the file from the application server in 7th step.
    Is there any specific CODE PAGE to be maintained...
    Thanks in advance
    Oarsk

  • How to upload the files using struts

    Hi all
    My requierment is to upload the files from the client machine and save it on the server, the file size must not increase more than 250 MB and to validate that we cannot do validation on the client machine so we have to validate it on the server side. below is my code kindly go through it if there is any problem in Bussiness Logic
    1>Upload.jsp
    2>UploadForm.java
    3>UploadAction.java
    *1>Upload.jsp*
    <%@ page language="java"%>
    <%@ page import="java.io.*"%>
    <%@ taglib uri="/WEB-INF/struts-bean" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html" prefix="html" %>
    <html>
    <body bgcolor="white">
    <form name="uploadForm" action="TestApplication/upload" method="post" enctype="multipart/form-data">
    <table>
    <tr>
    <td align="center" colspan="2">
    <font size="4">Please Enter the Following Details</font>
    </tr>
    <tr>
    <td align="left" colspan="2">
    <font color="red"></font>
    </tr>
    <tr>
    <td align="right">
    File Name
    </td>
    <td align="left">
    <input type="file"  name="theFile">
    </td>
    </tr>
    <tr>
    <td align="center" colspan="2">
    <input type="submit" value="UPLOAD">
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>*2>UploadForm.java*
    package com.MyPack.Datamatics;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.upload.FormFile;
    public class UploadForm extends ActionForm
         private static final long serialVersionUID = 1L;
    private FormFile theFile;
       public UploadForm(){}
       * @return Returns the theFile.
      public FormFile getThefile() {
        return theFile;
       * @param theFile The FormFile to set.
      public void setThefile(FormFile theFile) {
        this.theFile = theFile;
    } *3>UploadAction.java*
    package com.MyPack.Datamatics;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.upload.FormFile;
    public class UploadAction extends Action
      public ActionForward execute(
        ActionMapping am,
        ActionForm af,
        HttpServletRequest req,
        HttpServletResponse res) throws Exception{
         UploadForm myForm = (UploadForm)af;
            // Process the FormFile
            FormFile myFile = myForm.getThefile();
            String contentType = myFile.getContentType();
            String fileName    = myFile.getFileName();
              int fileSize       = myFile.getFileSize();
              String data="";
              try{
            java.io.InputStream fileData  = myFile.getInputStream();
             String path="E:/store";
              File f = new File(path);
              java.io.OutputStream outputStream = new FileOutputStream(f+"/"+fileName);
              int temp = 0;
              byte[] buffer = new byte[8192];
              temp = fileData.read(buffer, 0, 8192);
              while ((temp) != -1) {
              outputStream.write(buffer, 0, temp);
                   outputStream.close();
                   data = "file has beeb written to E:/store" + fileName;
                   fileData.close();
              catch (FileNotFoundException fnf)
              { System.out.println("Cannot Found the file");
               System.out.println(data);
              System.out.println("contentType: " + contentType);
             System.out.println("File Name: " + fileName);
             System.out.println("File Size: " + fileSize);
          return am.findForward("success");
    }Thanks in Advance

    [help link 1|http://www.roseindia.net/struts/strutsfileuploadandsave.shtml]
    [help link 2|http://www.roseindia.net/struts/strutsfileupload.shtml]

  • Problem in upload the file...

    Hi Gurus,
    I am new  in ABAP. I want to upload a file to Application Server.
    1. I create a file in Excel and give extension .prn and save on desktop so i think this file is on my presentation server.
    2. Now thru ABAP Editor i want to upload this file to Application Server
       Because i have to use this file in BDC.
    please give me the process..
    Thanks in Advance..
    Kind Regards
    Yogesh

    Hi Yogesh,
       As per the above suggestion you can use CG3Z tcode to upload your file directly from PS(Prersentation Server) to AS (Application Server).
       Otherwise if you need the procedure for coding, then first sav the file in .xls or .csv  or any format and upload the file into an internal table using any standard FM as per the extension ehich you use. Later use OPEN DATASET stmt. and open a file in AS and pass the data from your Internal table into this file through TRANFSER  stmt and after completing the required process use CLOSE DATASET stmt accordingly.
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards
    Nagaraj T

  • I have purchased a monthly subscription to Adobe PDF pack so that i can edit a PDF file, i have uploaded the file and its now in "my assets". how do i now edit this file??

    I have purchased a monthly subscription to Adobe PDF pack so that i can edit a PDF file, i have uploaded the file and its now in "my assets". how do i now edit this file??

    You can't edit a file with PDF Pack, but you should be able to convert it to a Word document, and if you are really lucky edit THAT and make a new PDF. Don't expect too much though!

  • How to upload the file without using java components?

    Hello,
    I need to upload the file using JSP, but I don't want to use java componets(such as
    jspsmart).
    Who can tell me how to realize it? This issue is very important to me,
    thanks all in advance!

    make you're own servlet using the multipartrequest from o'reilly.
    easy and simple, no jspsmart, only 1 jar file and some descent programming.
    I use it like that...

  • Uploading the file to server from the browser using JSP

    I have facing difficulty while uploading the file from the browser using user interface to the server or to the database. As previousy i was working in coldfusion, i find it very easy there with cffile command, but i am confused how to do that in JSP
    please reply soon, as i am stuck in my project because of that
    Sarosh

    Check out http://www.jspsmart.com , They have a nice free upload api that can be used w/ JSPs or Servlets. I hear O'Reilly has a nice one too. May as well use someone elses if they've done it already.

  • How to upload the files

    how to upload the files from javascipt.can any body send the code for that.

    You can't upload files with Javascript, that would be a huge security hole. At highest you can use Javascript to submit a form with a file field, but the user still have to select the file himself.

  • Field not visible when uploading the file in application ser

    Hi,
    I have added a new field at the end of a structure and When i upload the data in the application server it is not visible there. The new field length is 30chars(say field 'A')  and the one just before this one is 250 chars(say field 'B'). When i reduce the length of field 'B' to 30 chars or 40 chars the value which i populated in field 'A' is visble in the output file.
    Since the complete file was not visible in AL11 transaction, i used the CG3Y tcode as well to download the data to presentation server so that i can view the complete file. Even after downlaoding in presentation server the new field value is not visible.
    Can anyone please suggest why is the value in field 'A' not visible when the length of field 'B' is 250 chars? Also, how can i display the value of the new field in the application server.I cannot change the layout of the structure as per the requirement. Any help will be very useful.
    Thanks in advance,
    Sneha.

    Hi Sneha.. Happy new year
    <you subject is missing ver from the server, thats why your server doesnt like you :P>
    -ok, lets go step by step. how did you upload the file?
    -after uploading the file check the file in OS level(goto SM69, execute CAT, in additional parameter (not in parameter) give the full path (case sensitive), execute. ). here you can see the actual content of the file... check you data is present or not
    -which structure are you using to download and upload? a temp work area.. then please provide the WA details, so that i can try on my system.
    lets see what happens next
    one more thing: regarding AL11, it can read upto length 510 characters. check program RSWATCH0 form SHOW_FILE. here the read dataset into butffer is 510 characters.

  • How to use the applet to upload the file ?

    I am facing a problem that , I don't know how to use applet to upload the file to server .
    I have the code to upload the file by using servlet .
    However , I want to use applet to upload the file .But , the format of servlet I have used is "multipart/form-data"
    but applet can not do so , I think it is the header of the data . I don't know what can I do .....
    Can anyone give me some suggestion or coding to write the file upload by using applet ?
    Besides , using the socket are there any other choices ?
    thx a lot !!!!

    Well, to upload files you need to
    Server App - running on the webserver
    1. Open a socket
    (Study the classes Socket, InputStream, OutputStream in the Java API)
    2. Wait for connection.
    3. Open FileOutputStream
    3. Read data from InputStream, Write to FileOutputStream
    4. Close InputStream and FileOutputStream
    Applet
    1. Open a filedialog (Swing, AWT)
    2. Open file (FileInputStream)
    3. Connect to uploadServer (steps described above)
    4. Read FileInputStream, write OutputStream
    5. Close File and Socket
    This is just simpl and basic terms get you on the right track
    Jonas

  • At a time of uploading the file its giving a junk value.

    Hi  All,
    I am uploading .DOC file using GUI_UPLOAD function and its giving junk value in the internal table at a time of uploading the file.
    Is there any alternative or any function which can help me to upload the .DOC file or any scanned file?
    And is there any possibility to convert the junk value to the string or character?
    I would like to mention the version as i'm working on 5.0.
    Regards,
    Bhavani

    use File_type as 'BIN'

  • When i upload the files thorugh internet jvm memory is taking so much.

    i have integrated a file upload in my webapplication(JSP)
    when i upload the files thorugh internet jvm memory is taking so much.
    how can i reduce it.
    any open source for file upload process is there?
    thax,
    R. Ramasubramaniam.

    Suggestion: read [the documentation|http://commons.apache.org/fileupload/using.html] for it.
    By default it will store files in memory up to about 10k. Larger than that will be written to disk.
    If you are really worried about memory, perhaps you should take a look at the [streaming API|http://commons.apache.org/fileupload/streaming.html]
    How large are the files being uploaded?
    How many users are we talking about?

  • Jlaunch process using High CPU, while uploading the files in XI system

    Hi,
    we are facing  jlaunch high cpu usage problems, while uploading the files of more than 25MB, in XI system. PIAFUSER is running on PRIV mode and huge java core dumps and heapdumps are  getting generated in server0 node
    error message->  - Out of memory situations running XI
    Exception thrown [Fri Sep 30 13:57:27,855]:Exception thrown by application running in JCo Server
    java.lang.Exception: java.lang.OutOfMemoryError
         at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:237)
         at com.sap.engine.services.rfcengine.RFCJCOServer$J2EEApplicationRunnable.run(RFCJCOServer.java:254)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(AccessController.java:219)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
    first , we tested in Quality system, where,we are getting same problems as well.
    SAP Note 146289 - Parameter Recommendations for 64-Bit
    increased em/intial_size_MB  from 512MB to 2 GB and em/global_area_MB value from 96 to 256
    SAP Note 723909 - Java VM settings for J2EE 6.40/7.0
    we added some jvm parameters in confitool
    -Djava.awt.headless=true
    -XX:+UseParNewGC
    -XX:+PrintGCTimeStamps
    Present  JVM values in XQ1 system..
    Xmx  value 3072
    xms  value 2048
    xmn  value 1000
    we have tested JCo RFC's  AI_DIRECTORY_JCOSERVER and AI_RUNTIME_JCOSERVER , connection test was OK.
    We increased parameter com.sap.aii.ib.client.jnlp.j2se.maxheapsize from 512m to 800m
    Please advice me.. how to proceed..
    regards,
    balaram

    Hi Balaram,
    Kindly review below note, Hope it suits.
    716927 - Overview of AIX JVM for NetWeaver 2004 and 7.0 (2004s).
    Regards,
    Mani

  • How to upload the files of a directory to a server at one time?

    in a jsp page ,the user choose a directory ,then I want to upload the files of the directory to a server at one time.How to do this?Thanks!

    You create multiple file input fields and you have them select each file they want.
    Or tell the user to zip the directory and upload the zip file.
    Or use a signed applet to get all the files and send them.
    There's no way for the browser to select a directory.

  • (409) Conflict Error while uploading the file into Sharepoint library

    Getting the below error while uploading the file into Sharepoint library.
    (409) Conflict. at System.Net.HttpWebRequest.GetResponse() at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute() at Microsoft.SharePoint.Client.File.SaveBinary(ClientContext context, String serverRelativeUrl,
    Stream stream, String etag, Boolean overwriteIfExists
    I have used the below code:
    ClientOM.File.SaveBinaryDirect(clientContext, "/Shared%20Documents/NewDocument.pptx", memoryStream, true);
    Thanks in advance.

    May be issue is with path.
    https://server/ should be there instead of
    subsite path(https://server/path/path)
    in the client context
    Check the below link
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/fbb38b10-1127-48a6-a65f-0301edd766c4/the-remote-server-returned-an-error-409-conflict-error-while-uploading-files-to-sharepoint?forum=sharepointdevelopmentlegacy

Maybe you are looking for

  • Mount ocfs2 error in oracle 10g installation on vmware

    Dear All this is very urgent.....kindly help me... i m running this command for mount ocfs folder but not run gives error below....... [root@rac1 ~]#mount -t ocfs2 -o datavolume,nointr /dev/sda1 /ocfs ocfs2_hb_ctl: Bad magic number in superblock whil

  • XI / PI Positioning in NetWeaver LandScape

    Hi All, Regarding the Overall Positioning of  XI / PI with respect to ECC and BI, where does it stand. I know that We set up the Source System i.e. ECC would work as Source Sys for BI . But, about XI / PI I need some input. - How do we connect XI to

  • N8: How to assign custom SMS tone while keeping it...

    The task is pretty much outlined in the topic title, but I'll still elaborate: I want to assign Knock.aac (just a renamed Message 2.aac from my old N73) as a message tone, while keeping it hidden from the music library. Hiding it is simple: I just pu

  • PSU Problem

    HI all.I have a 450 (Peak load) ISO switching power supply (that's what's written on the side).Recently (about 2 months now) everytime i start my PC in the morning it makes a rattling noise from the power supply.I dind't take much mind to it but this

  • Limit Amount of messages stored for durable subscribers

    Hello, Is there any way to limit the number of messages stored for durable subscribers in OpenMQ. ActiveMQ has a property you can set: constantPendingMessageLimitStrategy = 10. Does OpenMQ have a similar property? Thanks, Ed