J2me multipart file upload-  Help Needed

package com.mpbx;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;
public class PostFile extends MIDlet implements Runnable, CommandListener{
    private final String FILE = "/image.jpg";
    private final String URL = "http://localhost/post.php"; // change this to a valit page.
    private final String CrLf = "\r\n";
    private Form form = null;
    private Gauge gauge = null;
    private Command exitCommand;
    private Command uploadCommand;
    public PostFile(){
        form = new Form("Upload File");
        gauge = new Gauge("Progress:", true, 100, 0);
        form.append(gauge);
        exitCommand = new Command("Exit", Command.EXIT, 0);
        uploadCommand = new Command("Upload", Command.SCREEN, 0);
        form.addCommand(exitCommand);
        form.addCommand(uploadCommand);
        form.setCommandListener(this);
    public void startApp() {
        Display.getDisplay(this).setCurrent(form);
    public void pauseApp() {
    public void destroyApp(boolean unconditional) {
    private void progress(int total, int current){
        int percent = (int) (100 * ((float)current/(float)total));
        gauge.setValue(percent);
    public void run() {
        httpConn();
    private void httpConn(){
        HttpConnection conn = null;
        OutputStream os = null;
        InputStream is = null;
        try{
            System.out.println("url:" + URL);
            conn = (HttpConnection)Connector.open(URL);
            conn.setRequestMethod(HttpConnection.POST);
            String postData = "";
            InputStream imgIs = getClass().getResourceAsStream(FILE);
        byte []imgData = new byte[imgIs.available()];
           imgIs.read(imgData);
            String message1 = "";
            message1 += "-----------------------------4664151417711" + CrLf;
            message1 += "Content-Disposition: form-data; name=\"uploadedfile\"; filename=\"" + FILE + "\"" + CrLf;
            message1 += "Content-Type: image/jpeg" + CrLf;
            message1 += CrLf;
            // the image is sent between the messages ni the multipart message.
            String message2 = "";
            message2 += CrLf + "-----------------------------4664151417711--" + CrLf;              
            conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=---------------------------4664151417711");
            // might not need to specify the content-length when sending chunked data.
            // conn.setRequestProperty("Content-Length", String.valueOf((message1.length() + message2.length() + imgData.length)));
            System.out.println("open os");
            os = conn.openOutputStream();
            System.out.println(message1);
            os.write(message1.getBytes());
            // SEND THE IMAGE
            int index = 0;
            int size = 1024;
            do{
                System.out.println("write:" + index);
                if((index+size)>imgData.length){
                    size = imgData.length - index;
                os.write(imgData, index, size);
                index+=size;
                progress(imgData.length, index); // update the progress bar.
            }while(index<imgData.length);
            System.out.println("written:" + index);           
            System.out.println(message2);
            os.write(message2.getBytes());
            os.flush();
            System.out.println("open is");
            is = conn.openInputStream();
            char buff = 512;
            int len;
            byte []data = new byte[buff];
            do{
                System.out.println("READ");
                len = is.read(data);
                if(len > 0){
                    System.out.println(new String(data, 0, len));
            }while(len>0);
            System.out.println("DONE");
        }catch(Exception e){
            e.printStackTrace();
        }finally{
            System.out.println("Close connection");
            try{
                os.close();
            }catch(Exception e){}
            try{
                is.close();
            }catch(Exception e){}
            try{
                conn.close();           
            }catch(Exception e){}
    public void commandAction(javax.microedition.lcdui.Command command, javax.microedition.lcdui.Displayable displayable) {
        if(command == exitCommand){
            this.notifyDestroyed();
        }else if(command == uploadCommand){
            new Thread(this).start();
}Running this yields the error below...Can someone suggest me. whats the problem.
url:http://localhost/post.php
java.lang.NullPointerException
        at com.mpbx.PostFile.httpConn(PostFile.java:85)
        at com.mpbx.PostFile.run(PostFile.java:68)
Close connection

I also faced the same problem. To make this code work you will have to include the image.jpg in the jar. To do that, copy the image file in the src directory inside your project folder (if you are using netbeans) and then build the project.
Remember, the web server should be running in background.

Similar Messages

  • File Upload Help Needed - Very Urgent

    Dear All
    I am making a application in Webdynpro for uploading an excel file to the server. Can someone give me a demo application so that I can run it and see whether my server is configured or not. Also I have made the application right now and have coded the need full. But when I select a file and say submit it shows me a page not found error. Currently I am working round the clock on my project and am stuck up here. Its very urgent can any body help please with an example or a demo application.
    Regards Gaurav

    Hi,
      Check whether in server, MultipartBodyParameterName property is set to "com.sap.servlet.multipart.body" . You can check this by going to Visual Admin -> Cluster tab -> Services -> web container -> Properties sheet.
    Do assign points if i answered your question.
    Regards
    Vasu

  • URGENT! File Upload Utility or a Custom UI for File Upload is needed!

    Hi all,
    I'm trying to find or develop a file upload utility or custom user interface rather than editing and adding file type item to a page. There is a free portlet for file upload in Knowledge Exchange resources, but it is for 3.0.9 release. I'm using portal 9.0.2.
    I could not any sample about the new release. Also API such as wwsbr_api that is used to add item to content areas is out dated.
    I create a page with a region for "items". When "edit" page and try to add an "file" type item the generated url is sth like this;
    "http://host:7779/pls/portal/PORTAL.wwv_additem.selectitemtype****"
    After selecting item type as a simple file autogenerated url is sth. like ;
    "http://host:7779/pls/portal/PORTAL.wwv_add_wizard.edititem"
    I made search about these API but could not find anything (in PDK PL/SQL API help, too).
    I need this very urgent for a proof of consept study for a customer.
    Thanks in advance,
    Kind Regards,
    Yeliz Ucer
    Oracle Sales Consultant

    Answered your post on the General forum.
    Regards,
    Jerry
    PortalPM

  • Pure ASP Upload help needed...

    Trying to create simple upload page...
    But nothing seems to be happening
    Can anyone offer suggestions on what to check?
    I created 2 pages...
    Page #1 = Simple form with 3 fields title, file upload and
    page
    Page #2 = simple thank you message to confirm upload
    Im sure its something simple... but when i click on Submit
    nothing happens..
    its like nothing is executing the upload...
    I have checked the permissions on the scriptslibrary, the
    upload folder
    where the files will be placed and they are set to same
    read/write/ execute
    Below is the code on the page with the upload option:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <!--#include virtual="/Connections/webuplo.asp" -->
    <!--#include virtual="/ScriptLibrary/incPU3Class.asp"
    -->
    <!--#include virtual="/ScriptLibrary/incPU3Utils.asp"
    -->
    <%
    '*** Pure ASP File Upload 3.0.9
    ' Process form form1
    Dim pau, DMX_uploadAction, UploadRequest, UploadQueryString,
    pau_thePath,
    pau_nameConflict, pau_saveWidth, pau_saveHeight
    Set pau = new PureUpload
    pau.ScriptLibrary = "/ScriptLibrary"
    pau.TimeOut = 500
    pau.ConflictHandling = "over"
    pau.StoreType = "path"
    pau.UploadFolder = """../vendor_compliance"""
    pau.Required = true
    pau.AllowedExtensions = "DOC,PDF" ' "custom"
    pau.ProcessUpload
    pau.SaveAll
    %>
    <%
    Dim MM_editAction
    MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
    If (UploadQueryString <> "") Then
    MM_editAction = MM_editAction & "?" &
    Server.HTMLEncode(UploadQueryString)
    End If
    ' boolean to abort record edit
    Dim MM_abortEdit
    MM_abortEdit = false
    %>
    <%
    If (CStr(UploadFormRequest("MM_insert")) = "form1") Then
    If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd
    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_webuplo_STRING
    MM_editCmd.CommandText = "INSERT INTO dbo.tbl_docs
    (linktitle,
    uploadfile, displaypage) VALUES (?, ?, ?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param1", 201,
    1, 50, UploadFormRequest("linktitle")) ' adLongVarChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param2", 201,
    1, 100, UploadFormRequest("uploadfile")) ' adLongVarChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param3", 201,
    1, 5, UploadFormRequest("displaypage")) ' adLongVarChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "/admin_new/insert_docu_com.asp"
    If (UploadQueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0)
    Then
    MM_editRedirectUrl = MM_editRedirectUrl & "?" &
    UploadQueryString
    Else
    MM_editRedirectUrl = MM_editRedirectUrl & "&" &
    UploadQueryString
    End If
    End If
    Response.Redirect(MM_editRedirectUrl)
    End If
    End If
    %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN"
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <title>Upload Documents</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    <script
    type="text/javascript"><%=pau.generateScriptCode()%></script>
    <script src="/ScriptLibrary/incPU3.js"
    type="text/javascript"></script>
    </head>
    <body bgcolor="#FFFFFF">
    <form ACTION="<%=MM_editAction%>" METHOD="post"
    enctype="multipart/form-data" name="form1" id="form1"
    onsubmit="<%=pau.submitCode()%>;return
    document.MM_returnValue">
    <label>Title<input name="linktitle" type="text"
    id="linktitle" size="40"
    /></label>
    <br>
    <label>Upload<input name="uploadfile" type="file"
    id="uploadfile"
    onchange="<%=pau.validateCode()%>;return
    document.MM_returnValue" size="40"
    /></label>
    <br>
    <label>Display Page
    <select name="displaypage" id="displaypage">
    <option>Please select a Page</option>
    <option value="vc">Vendor Compliance</option>
    <option value="n">News</option>
    </select>
    </label>
    ( Select page to be displayed on ) <br>
    <input name="Submit" type="button" id="Submit"
    value="Upload" />
    <input type="hidden" name="MM_insert" value="form1">
    </form>
    </body>
    </html>
    ASP, SQL2005, DW8 VBScript

    Not sure what or why this is happening.. or if its now
    related to IE7,
    But after all the problems i had and corrected below.. i now
    have the same
    problem and this time all the code seems to look ok..
    All i did was add 4 more fields of data to be collected, made
    sure that the
    insert record behavior reflects the new fields and everything
    is ok.. but
    using IE7 when i complete the form and hit update, the page
    post back saying
    i have incomplete data and nothing is written to the
    database.
    ASP, SQL2005, DW8 VBScript
    "Daniel" <[email protected]> wrote in message
    news:[email protected]...
    >I really appreciate everyones help.. i went thru and
    compared line by line
    >with the one that worked and the one that wasnt and it
    was a simple code
    >error...
    >
    > On the page that works: this is how the submit was
    coded...
    > <input type="submit" name="Submit" value="Submit"
    />
    >
    > On the page that didnt work it was coded like this:
    > <input name="Submit" type="button" id="Submit"
    value="Upload" />
    >
    > Apparently there is an order to this.. i ordered
    everything the same and
    > it finally worked...
    >
    >
    > --
    > ASP, SQL2005, DW8 VBScript
    > "Daniel" <[email protected]> wrote in message
    > news:[email protected]...
    >> Trying to create simple upload page...
    >>
    >> But nothing seems to be happening
    >>
    >> Can anyone offer suggestions on what to check?
    >>
    >> I created 2 pages...
    >> Page #1 = Simple form with 3 fields title, file
    upload and page
    >> Page #2 = simple thank you message to confirm upload
    >>
    >> Im sure its something simple... but when i click on
    Submit nothing
    >> happens.. its like nothing is executing the
    upload...
    >> I have checked the permissions on the
    scriptslibrary, the upload folder
    >> where the files will be placed and they are set to
    same read/write/
    >> execute
    >>
    >> Below is the code on the page with the upload
    option:
    >>
    >> <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    >> <!--#include virtual="/Connections/webuplo.asp"
    -->
    >> <!--#include
    virtual="/ScriptLibrary/incPU3Class.asp" -->
    >> <!--#include
    virtual="/ScriptLibrary/incPU3Utils.asp" -->
    >> <%
    >> '*** Pure ASP File Upload 3.0.9
    >> ' Process form form1
    >> Dim pau, DMX_uploadAction, UploadRequest,
    UploadQueryString, pau_thePath,
    >> pau_nameConflict, pau_saveWidth, pau_saveHeight
    >> Set pau = new PureUpload
    >> pau.ScriptLibrary = "/ScriptLibrary"
    >> pau.TimeOut = 500
    >> pau.ConflictHandling = "over"
    >> pau.StoreType = "path"
    >> pau.UploadFolder = """../vendor_compliance"""
    >> pau.Required = true
    >> pau.AllowedExtensions = "DOC,PDF" ' "custom"
    >> pau.ProcessUpload
    >> pau.SaveAll
    >> %>
    >> <%
    >> Dim MM_editAction
    >> MM_editAction =
    CStr(Request.ServerVariables("SCRIPT_NAME"))
    >> If (UploadQueryString <> "") Then
    >> MM_editAction = MM_editAction & "?" &
    >> Server.HTMLEncode(UploadQueryString)
    >> End If
    >>
    >> ' boolean to abort record edit
    >> Dim MM_abortEdit
    >> MM_abortEdit = false
    >> %>
    >> <%
    >> If (CStr(UploadFormRequest("MM_insert")) = "form1")
    Then
    >> If (Not MM_abortEdit) Then
    >> ' execute the insert
    >> Dim MM_editCmd
    >>
    >> Set MM_editCmd = Server.CreateObject
    ("ADODB.Command")
    >> MM_editCmd.ActiveConnection = MM_webuplo_STRING
    >> MM_editCmd.CommandText = "INSERT INTO dbo.tbl_docs
    (linktitle,
    >> uploadfile, displaypage) VALUES (?, ?, ?)"
    >> MM_editCmd.Prepared = true
    >> MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param1", 201,
    >> 1, 50, UploadFormRequest("linktitle")) '
    adLongVarChar
    >> MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param2", 201,
    >> 1, 100, UploadFormRequest("uploadfile")) '
    adLongVarChar
    >> MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param3", 201,
    >> 1, 5, UploadFormRequest("displaypage")) '
    adLongVarChar
    >> MM_editCmd.Execute
    >> MM_editCmd.ActiveConnection.Close
    >>
    >> ' append the query string to the redirect URL
    >> Dim MM_editRedirectUrl
    >> MM_editRedirectUrl =
    "/admin_new/insert_docu_com.asp"
    >> If (UploadQueryString <> "") Then
    >> If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare)
    = 0) Then
    >> MM_editRedirectUrl = MM_editRedirectUrl & "?"
    & UploadQueryString
    >> Else
    >> MM_editRedirectUrl = MM_editRedirectUrl &
    "&" & UploadQueryString
    >> End If
    >> End If
    >> Response.Redirect(MM_editRedirectUrl)
    >> End If
    >> End If
    >> %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN"
    >> "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    >> <html xmlns="
    http://www.w3.org/1999/xhtml">
    >> <head>
    >> <title>Upload Documents</title>
    >> <meta http-equiv="Content-Type"
    content="text/html; charset=iso-8859-1"
    >> />
    >> <script
    type="text/javascript"><%=pau.generateScriptCode()%></script>
    >> <script src="/ScriptLibrary/incPU3.js"
    type="text/javascript"></script>
    >> </head>
    >> <body bgcolor="#FFFFFF">
    >> <form ACTION="<%=MM_editAction%>"
    METHOD="post"
    >> enctype="multipart/form-data" name="form1"
    id="form1"
    >> onsubmit="<%=pau.submitCode()%>;return
    document.MM_returnValue">
    >> <label>Title<input name="linktitle"
    type="text" id="linktitle"
    >> size="40" /></label>
    >> <br>
    >> <label>Upload<input name="uploadfile"
    type="file" id="uploadfile"
    >> onchange="<%=pau.validateCode()%>;return
    document.MM_returnValue"
    >> size="40" /></label>
    >> <br>
    >> <label>Display Page
    >> <select name="displaypage" id="displaypage">
    >> <option>Please select a Page</option>
    >> <option value="vc">Vendor
    Compliance</option>
    >> <option value="n">News</option>
    >> </select>
    >> </label>
    >> ( Select page to be displayed on ) <br>
    >> <input name="Submit" type="button" id="Submit"
    value="Upload" />
    >> <input type="hidden" name="MM_insert"
    value="form1">
    >> </form>
    >> </body>
    >> </html>
    >>
    >> --
    >> ASP, SQL2005, DW8 VBScript
    >>
    >
    >

  • Servlet file uploading code need.

    Hello
    Can somebody give me a sourcecode of working servlet program that do file uploading on the server?
    thnks

    He's not angry at you, he's just angry at the self-serving tone of your post.
    Why don't you give me a $100 USD... while at it? Oh, no? But WHY? Why oh why? I'm such a good person of liberal character - could you give me a 100 dollars RIGHT NOW? Oh, you wouldn't - I see...
    Almost the same w/that "give me source code" :)....

  • File upload - I need help

    [Sorry 'bout my bad English]
    I'm trying to upload a file in a JSP. This page do a post to another JSP. In this page I have the code (there is more):
    1)PrintWriter pw = new PrintWriter(
    2) new BufferedWriter(new FileWriter( file)));
    3) ServletInputStream in = request.getInputStream();
    4) int i = in.read(); // here I got the error
    5) while ( i != -1 ) {
    6) pw.print((char) i);
    7) i = in.read();
    8) }
    I got an error that the file was not open, so I run the page in the debug mode, and I notice that the lenght of 'in', just after line 3, is 0.
    Please help
    thank you.

    read this. its 4 pages. tells ya everything you need to know.
    http://www.onjava.com/pub/a/onjava/2001/04/05/upload.html?page=1
    -S-

  • Error while importing the epa file..help needed urgently..

    Hi,
    I am facing a severe problem, I have developed a portal application, designed the pages, iViews roles etc and exported to a file and later downloaded the epa file.
    For testing purpose, I deleted my content folder of the pages and iViews from the content administration. But when i tried to import the file, I am getting an error message
    <b>" Error extracting the package file. Check the log files for details. "</b>
    When i lokked the log file, i found the exception as
    <b>" [com.sapportals.portal.transport.ui.ImportComponent] Error while extracting EP6.0 package C:
    usr
    sap
    J2E...
    MyEpafile.epa "</b>
    and below the erro i found an exception message as <b>"error in opening zip file"</b>
    When i tried to extract the file using winzip, I can extract it with out any problem..
    Can you please tell me how this happened?
    Please help me to solve this problem,
    Thankyou,
    Sudheesh...

    Hi Christopher,
    Well, I have solved the problem. But I don't know whether it will be the correct technical way.. Because i have to solve the same under a very little time constraint. The solution is given below,
    I unzipped the epa file which i have downloaded using winzip. inside the extracted file, i found a zip file with the same file name and extension. when i uploaded that file, it worked fine with out any problem. I tried the same many times. and each time i got the same results.
    Please try this if you are still facing the problem..
    Best regards,
    Sudheesh...

  • Local Area Network File Sharing Help Needed Please!

    Hello I've got a question. I'm trying to set up two Macs that are connected to the same router so that we can share files between each one. Is there a way to do this so that there's only ONE specific folder that each computer has access to on the other?
    For instance I'd like it so that there's ONLY ONE folder on my hard drive that the other computer can access and vice versa.
    Is this possible? I've read some literature on this subject and it says that when you allow sharing it makes your entire public directory accessible and that's not what I want.
    Thanks in advance for your help!

    Hi Paul, this is straight forward to do and have it work each time your 'client' mac starts up for a particular user.
    Assumtions:
    • both macs share the same subnet (Assuming the one used by the router)
    • assuming you can communicate with each of them from each other .
    • assuming both of these are OS 10.4 or 10.3 .. just making sure its not another ye olde os)
    • assume that the MAC where you want the FOLDER (directory) placed is always going to be available. (ie doesn't fall into sleep mode)
    • assuming reasonable network speed (I dont know what you client MAC will be using in its work flow - large or small files e.g.)
    • assuming that you dont mind if ANYONE in your system of two macs can accesse the folder (keep it simple for now)
    Steps:
    (on your SERVER mac).. the "NAS server" machine.
    • create the folder in your ~/public/<myshared_foldername> (anywhere would do btw or on one of the volumes in /volumes.....
    •set up the priviliges using the FINDER WINDOW for the foler (+i) (get info)
    (for example there is an "OWNERSHIP and PERMISSIONS" .. expand it all and it's pretty self explanatory". For simplicity here, just make it available to ALL and sundry.
    • do what ever you do to put an icon and a label & comment on the folder
    (on your client mac)
    • assuming all network connections are cool and you have both airport and/or ethernet/and or/FW connectivity via your router....
    • in the finder use +k (go to server) and put in the local name of or the IP address (to choose your fastest path) to the MAC that is your server.
    • answer any prompts for user and password. If you dont care, you can have that MAc log into the SERVER mac using your normal user and passwrd as a registered user, else default to guet.
    All so far very simple.
    Now the tric is to have it AUTOMATIC so tha when your client mac startups and someone on that machine needs access to your SERVER (As a NAS server), it just happens.
    and this is simply achived on the client machine by adding ing it into the LOGIN ITEMS for that user (and the others).
    How is that done?
    Simply DRAG AND DROP the desktop folder icon of the folder(s) to be shared) into the "login items" for the (system preferences/accounts/" users on the CLIENT machine. If there are multiple usres that need this then do it for all of them or have them do it.
    I think you can also enable some options in the SERVER's (NAS) system preferences/"energy saver" to wake itup whould it go to sleep.. such as 'wake up for ether net access" or something.
    anyway.. it gets more complex when you want to perform specific accesses and rights to the folders and the sub directories.
    This is simply implementing NFS I beleive.
    This will work first time and we use it all the time without the need for COTS or brand-x software.apps to make it happen.
    hope that helps

  • Seeking file upload help.

    Hi,
    This has been frustrating me severely of late.  I have two pages that visitors of my site shall go to for uploading photos.  The first page is a simple two question form asking them to enter how many photos will they be uploading in a text field as well as a select drop down of recent dates for which their pictures pertain to. Once those questions are answered and a visitor hits submit, the next page contains the total number of browse dialogue boxes for the # of photos that they intend to submit. Keep in mind that each person is meant to upload photos for just one day at a time and their uploads will go to a specific folder for that date.   I've passed the value of $_POST['selct_dates'] to a variable on the second page like $date = $_POST['selct_dates'] and tried appending this value to what has been defined as the top level 'uploads' folder. So the defined pathway is this... define('SOURCE_DIR', 'C:\inetpub\wwwroot\mysite\images\\'.$date.'\\');
    Then to upload the files I should be able to do this...
    $file = ($_FILES['image']['name']);
    if (array_key_exists('upload', $_FILES) {
    define('SOURCE_DIR', 'C:\inetpub\wwwroot\mysite\images\\'.$date.'\\');
              foreach ($file as $number => $file) { 
    $success = move_uploaded_file($_FILES['image']['tmp_name'][$number],SOURCE_DIR.$file); } }
    So upon upload, the file(s) would go to SOURCE_DIR.$date while the $file variable may be appended to this pathway,.right?
    there's actually one more foreach loop included in my actual code due to my select form element having been built as a looped array such as
    /*   echo '<option value="' . $option . '"';
    if (in_array($option, $date)) {
      echo " selected";
    echo ">" . ucfirst($option) . "</option>"; */ but that's a bit more complicated....
    So anyway my trouble has been that the SOURCE_DIR is set as it should be when the visitor first goes to the second page.  But after hitting 'upload' photos on the submit button as the final step, the SOURCE_DIR is no longer the pathway when echoing $var = $SOURCE_DIR.$date.  But rather it echos SOURCE_DIR\some_date.  For example when I first navigate initially to the file selection page 2 from the questionaire page 1, I can echo that SOURCE_DIR.$date equals the pathway C:\inetpub\wwwroot\mysite\uploads\06_01\ . However after a visitor hits the submit button the page refreshes and the echo is SOURCE_DIR\06_01\
    Essentially the SOURCE_DIR isn't retaining it's value as a pathway but rather takes on the literal string. Hence the photos are not making it to their desired directory. How can I make the SOURCE_DIR constant remain set all the way through the visitor hitting submit?   Thank you.

    You might find it more helpful to post in a forum which is at least marginally relevant to the question. I don't see any XML content at all in that question.

  • Saving to file. Help needed

    I'm designing an electrionic organiser, it only does one year and for each month the user can enter appiontments (which is just a simple text area the user enters text to).
    I have prity much everything finshed but I don't know how I should store the users data. What way should I save the data to file for each day of each month. So it is easily loaded again.
    Please Help

    I was given this code to use is this what you where talking about?
    /* An object of this class enables a user to read and/or write whole objects from/to a given file:
              - read from the set file (if the file is found - otherwise a new default object is created)
              - write a given object to the set file
          At present, this class reads objects of type 'myObjectClass' (and writes objects of any type). 
          To serialize other classes, only six lines in the readObjectFromFile method need to be edited:
                 - lines 38, 40, 47, 52, 57 and 62.
          The typical usage of this class involves:
                    - creating an instance of simpleSerializer, passing in the file object
                    - reading and/or writing objects:
                             simpleSerializer S = new simpleSerializer (new File("myData.dat"));
                             S.readObjectFromFile();
                             S.writeObjectToFile(myObject);
    import java.io.*;
    public class simpleSerializer
         public File theFile;  // the set file for reading and writing
         public simpleSerializer(File f)
              theFile = f;
         } // constructor
         /* The following method can be edited to read objects of your class (myObjectClass, here) */
         /* To read other classes, replace the six references to myObjectClass                  */
         public myObjectClass readObjectFromFile()
              myObjectClass d;
              if ((theFile!=null) && theFile.exists())
                   try
                        ObjectInputStream ois = new ObjectInputStream( new FileInputStream(theFile));
                        d = (myObjectClass) ois.readObject();
                        ois.close();
                   catch (IOException e) 
                   { /* handle problem with fault in reading the file */     
                        d = new myObjectClass();
                        System.out.println("** IO Exception when reading file");
                   catch (ClassNotFoundException cnfe) 
                   { /* handle problem with fault in reading the file */ 
                        d = new myObjectClass();
                        System.out.println("** Class not found when reading file");
              else // file didn't exist - construct a new default myObjectClass using constructor
                   d = new myObjectClass();
              return d;
         } // readObjectFromFile
         public void writeObjectToFile(Object d)
              try
                   ObjectOutputStream oos = new ObjectOutputStream( new FileOutputStream(theFile));
                   oos.writeObject(d);
                   oos.close();
              catch (IOException e)  { /* handle problem with fault in reading the file */     }
         } // writeObjectToFile
    } // simpleSerializer

  • Hyperlinks text to file?Help needed

    hi guys,i need some help in Abode Flash Professional CS 5.5 . im new to Flash,need some serious help over here =( deadline is tomorrow ><
    Here's the Senario :
      -im editing a flash website,and i need to do some hyperlink to the text.but instad of hyperlinking those text to other website,i want to link them to my file which i had in the folder.
    - also to ask if its able to hyperlink an image to a website i want.if can,how to do it.if cant,any other option i can link them?
    - i also created a Form for people to enter their information like email address and names to my email address.but when they click Send Button,i dont receive the mail.how can i do it?
    Many thanks for people replying to this Discussion.

    If you want to launch the local mail client to send mails, read the below tutorial
    http://www.flashdesignerzone.com/tutorials/t1011.php
    If you want to send the mail and receive on somether client like hotmail,gmail etc, read the below tutorial:
    http://www.kirupa.com/developer/actionscript/flash_php_email.htm

  • Flat FIle Upload Help!

    Hi, I will have a unix directory of 10-20 text files with different names, but same structure that I need to load into BW.  The directory will have any number of files with different names and they all need to be loaded.  How can I come up with a solid process to load these files? 
    I thought just calling an ABAP program to loop through the file names and execute the same DTP somehow using a different file name?  Is this possible?  Any thorough help is greatly appreciated.
    Thanks,
    Ken Murray

    Kenneth,
        Good Question!
        on the External Data Tab Page, we haev one option "<b>Create Routine</b>". We can use that option to dynamically generate the File Name. Still we need to have several Infopackages to load the data. i don't see any advantage creating this. This routine will be useful if the file name varies based on some criteria. not to process all the files in directory. for that we need to process Infopackages those many times.
    Keep all the file Names in a Table rather than DSO.
    In my view, instead of using Infopackges. Try creating an ABAP program and read the File Names which you saved in Transparent Table(all 30 files in to Internal Tables). Call the Funcion Module (BAPI_IPAK_CHANGE) to schedule the Infopackage for 30 times using different Names. then one infopackage will be sufficient.
    all the best.
    Regards,
    Nagesh Ganisetti.

  • Read from Text File Detailed Help need Clean-up

    This is probably well known and nobody has bothered fixing it but the detailed Help of the "Read from Text File" function is sort of ambiguous:
    -  statement 1: refnum out is the refnum of the file that the function read. You can wire this output to another file function, depending on what you want to do with the file. The default is to close the file if it is referenced by a file path or selected from the file dialog box. If file is a refnum or if you wire refnum out to another function, LabVIEW assumes that the file is still in use until you close it.
    - statement 2: If you wire a path to file, the function opens the file before reading from it and closes it afterwards.
    I have found statement 1 to be correct, which makes statement 2 incomplete (and sort of tautological in the sense that 1) you expect LabVIEW to open the file before reading from it if you provide a path instead of a refnum... and 2) if you use a path input to file AND use the refnum out for some other function, the file is NOT closed, as correctly stated in statement 1).
    Just sayin' ...

    X,
    It deeply concerns me that you would take my response to mean indifference. I certainly had no intention to belittle what you had to say. On the contrary, I took this up with the concerned team, and had a small discussion. If you say that what someone says on this forum is of lesser or no value to National Instruments, you could not be more wrong. It defeats the whole purpose of this public forum.
    My point was not that it is not an issue, it certainly seems to be. Please be rest assured that even if it does not look like it from the outside, each comment however big or small is taken back to our workplaces and some thoughts poured over it. 
    On the whole, I recognise that I had a role to play in this misunderstanding of tone, and I sincerely apologise.
    Warm Regards,
    Prashanth N
    National Instruments

  • Linked excel file problem - Help needed

    I have 2 excel files in the same directory in Content Services. The "destination" file has a link in one of its cells to a cell in the "source" file. I want to be able to open the "destination" file and update the data if any changes have been made to the "source" file.
    My problem is when I try to do this i get an error that says "This workbook contains one or more links that cannot be updated" and two options.
    1) To change the source of links, or attempt to update values again, click Edit Links.
    2) To open the workbook as is, click Continue.
    If I click Edit Links I am then presented with a screen where I can open the "source" file. When I try to do this though I am given a login screen. Supplying a valid Content Services username and password doesn't work and I cannot open the file.
    Can anyone tell me how I can open the "destination" file without having to open every "source" file? I don't want to open the "source" files because there could be dozens of "source" files for one "destination" file.

    setw is the equivalent of the field width value in printf. In your code, the printf version would look like:
    printf("%8s", CURSOR->name.c_str());
    I much prefer printf over any I/O formatting in C++. See the printf man page for more information. I recommend using Bwana: http://www.bruji.com/bwana/
    I do think it is a good idea to verify your code on the platform it will be tested against. That means Visual Studio. However, you don't want to use Visual Studio. As you have found out, it gets people into too many bad habits. Linux is much the same way. Both development platforms are designed to build anything, whether or not it is syntactically correct. Both GNU and Microsoft have a long history of changing the language standards just to suit themselves.
    I don't know what level you are in the class, but I have a few tips for you. I'll phrase them so that they answers are a good exercise for the student
    * Look into const-correctness.
    * You don't need to compare a bool to 1. You can just use bool. Plus, any integer or pointer type has an implicit cast to bool.
    * Don't reuse your CURSOR pointer as a temporary index. Create a new pointer inside the for loop.
    * In C++, a struct is the same thing as a class, with all of its members public by default. You can create constructors and member functions in a struct.
    * Optimize your function arguments. Pass by const reference instead of by copy. You will need to use pass by copy at a later date, but don't worry about that now.
    * Look into initializer lists.
    * In C++ NULL and 0 are always the same.
    * Return the result of an expression instead of true or false. Technically this isn't officially Return Value Optimization, but it is a good habit.
    Of course, get it running first, then make it fancy.

  • RECEIVER FILE FCC - Help needed.

    Hi,
    Iam working on a idoc-to-file interface.My receiver structure is as follows:
    <HEADER_1st_LINE>
          <field1>
         <field2>
       <field n>
    </ HEADER_1st_LINE>
    <HEADER_2nd_LINE>
          <field1>
         <field2>
       <field n>
    </ HEADER_2nd_LINE>
    <PO_LINE>
      <POLINE_1st_LINE>
          <field1>
         <field2>
       <field n>
    < /POLINE_1st_LINE>
    <POLine_2ndLine>
       <field1>
         <field2>
       <field n>
    </ POLINE_2nd_LINE>
    </PO_LINE>
    My FILE RECEIVER channel is as follows:
    RECORDSET STRUCTURE : HEADER_1stLINE,HEADER_2ndLINE,POLINE,POLINE_1stLINE,POLINE_2ndLINE
    Kindly pls help me in content conversion parameters.My target structure should be as follows:
    HEADER_1st_LINE
    HEADER_2nd_LINE
    POLINE_1st_LINE
    POLINE_2nd_LINE
    POLINE_1st_LINE
    POLINE_2nd_LINE
    POLINE_1st_LINE
    POLINE_2nd_LINE
    Thanks in advance,
    Cheers,
    Ram.

    Hi Kenneth,
    Thanks for your reply.
    PO_LINE has two child nodes...POLINE_1st_LINE & POLINE_2nd_LINE respectively.
    In the target flat file i must generate the structure which has the following nodes in sequence :
    HEADER_1st_LINE
    HEADER_2nd_LINE
    POLINE_1st_LINE
    POLINE_2nd_LINE
    POLINE_1st_LINE
    POLINE_2nd_LINE
    POLINE_1st_LINE
    POLINE_2nd_LINE
    How to write Content Conversion Parameters so as to achieve my task of generating the desired file structure ?
    Cheers,
    Ram.

Maybe you are looking for