Help with file uploader, php script, Windows Authentication

I am trying to setup a really basic web-based file uploader that I will expand upon later. I have the flex application working well enough (very basic). However, I have a php script in a secure folder using windows authentication. When I try to send the file to the script, it doesn't seem to like my credentials, and refuses to do anything. I do not get an error message; just nothing happens.
My questions are:
Does anybody know where I should've looked before posting this thread?
Do I even have PHP set up correctly? (At first I just made a txt file and put a .php extension on it, then I tried to setup PHP on the server, but it was a little confusing for me)
Is Windows Authentication the problem?
I do plan on implementing SQL Server in the future (to keep track of Files and user-defined attributes for files), but I do not want to store the files in SQLserver, just their pathnames.
Is there a simple way to use ColdFusion (for free) to acheive this end?
I am somewhat experienced at coding applications, but am totally new to server-side scripts.
This is my php script:
<?php
$tempFile = $_FILES['Filedata']['tmp_name'];
$fileName = $_FILES['Filedata']['name'];
$fileSize = $_FILES['Filedata']['size'];
move_uploaded_file($tempFile, "./" . $fileName);
?>
This is my flex application:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                  xmlns:s="library://ns.adobe.com/flex/spark"
                  xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
     <![CDATA[
     private var fileRef:FileReference
     private var uploadFilePath:String
     private function selectFile():void
          fileRef = new FileReference();
          fileRef.addEventListener(Event.SELECT, fileRef_select);
          fileRef.browse();
     private function fileRef_select(evt:Event):void
          fileRef.upload(new URLRequest("http://SERVERLOCATION/PDFUploader.php"));
     ]]>
</fx:Script>
     <s:Button top="30" left="5" label="Browse" click="selectFile()"/>
</s:Application>
Thanks to any who take the time to respond.

Hey, so far all I have found is this tutorial.. I'm about to try it out
http://www.smartwebby.com/Flash/external_data.asp

Similar Messages

  • Help with file upload Actionscript

    I am trying to do a file upload using Actionscript and a
    modified version of the tutorial found at:
    http://tutorials.lastashero.com/2005/10/creating_a_file_upload_applica.html
    When I call the function
    fileRef.upload("
    http://www.imgthis.com/upload_loader.php");
    should that go to that page once it finishes, or how do I
    force Flash to redirect the browser to that page passing the
    uploaded file?
    What am I missing here, or what else would anyone need to
    help me?
    Any help would be greatly appreciated thanks in advance!
    Joshua Abts

    It seems as though the page is not being loaded after the
    ActionScript upload command.
    Why would my PHP script not be called from the upload
    ActionScript? I even just did a simple one line redirect to see if
    the PHP script was even being called and it didn't work.
    What is the basis for getting the script to send the picture
    to the PHP script as a post and using the $_FILES array?
    Thanks,
    Josh

  • Help with File Upload manually

    Hi Experts,
    I need code to upload a file without using the upload UI Element. we have our terms and conditions which has to be signed by the user and once the user signs and clicks the next button to go to the next page, I generate a pdf with the time stamp of when the user signed and upload it to ECC. here i can not use the File upload UI Element but have to upload it automatically to ECC.
    Can any one help me out with this please.
    Thanks

    Hi,
    I dont know why you need to to upload the file for this requirement. You can simply store the user id and the timestamp in portal database table or in a ECC z table.
    In case you definitely need to upload the file then you can use KM API to uploadthe file to portal KM folder
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a099a3bd-17ef-2b10-e6ac-9c1ea42af0e9?quicklink=index&overridelayout=true
    but you need not use the upload feature in the example, instead just get the data from wd context and upload to KM.
    Srini

  • Help with file upload

    I was wondering if there's a kind of lightweight component for uploading files in JSF. I tried Oracle's ADF Faces, but besides it being a couple of megs it screwed up the HTML code in my pages and some Javascript functions wouldn't work. I saw a post here where someone created his own component but as it will have minor use in my app i'd like something packed so I can just add it on.
    I only need to upload one file in my app, so maybe it's better to use a regular JSP and Servlet approach for this one. Suggestions or comments would be appreciated, thanks..

    I followed the examples in the chapter, but I needed a .tld file so I created one:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib
    PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
    "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
    <tlib-version>1.0</tlib-version>
    <jsp-version>1.2</jsp-version>
    <short-name>file</short-name>
    <uri>http://java.sun.com/upload</uri>
    <display-name>JSF File Upload</display-name>
    <description>File upload library fo JSF</description>
    <tag>
    <name>upload</name>
    <tag-class>com.corejsf.UploadTag</tag-class>
    <body-content>JSP</body-content>
    <description>
    Uploads the file.
    </description>
    <attribute>
    <name>value</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
    <name>target</name>
    <required>false</required>
    <rtexprvalue>false</rtexprvalue>
    </attribute>
    </tag>
    </taglib>
    Its in WEB-INF and declared in web.xml, but I'm getting an error:
    javax.faces.FacesException: Expression Error: Named Object: 'com.corejsf.Upload' not found.
    There's no such class in the component, but the UploadTag returns "com.corejsf.Upload" in both getRenderedType() and getComponentType().
    If someone has this working; help please!!

  • Help with phpMyAdmin setup.php script

    Hi all,
    I am a newbie to Arch Linux even though I've been running Linux (-only) for more than a year. I have been mostly running Debian based distributions, so sometimes I feel a bit lost on Arch. So far I have been able to set everything up, from wireless to X server (by just reading the instructions, and some posts in the forum).
    Now I am stuck with something that is not so distro-related, I was following this guide (http://wiki.archlinux.org/index.php/LAMP) but I got stuck at the configuration script for phpMyAdmin.
    In fact, when I go to the address http://localhost/phpMyAdmin/scripts/setup.php I can only see the PHP code, not the web page.
    Now I am sure that Apache is running properly since my php test page runs just fine. So I cannot figure out why the setup.php page does not show correctly.
    Could somebody please give me some hints?
    Any help is greatly appreciated,
    Thanks for your time.

    np .. i forgot one point though , you needed to restart the web server so the php module takes the new settings. this is the case fro all config changes to either teh websierver or a modules/addon

  • Help With File Sharing Mac OS / Windows 7

    Hello,
    I have both operating systems on my network. The only files I can not see are the Mac's. Below are the steps I took to insure the Mac to be seen on the network, but I must be missing somethnig. I only see the printer attached to the Mac.
    Workgroup -> Both systems set to the same Workgroup name.
    Network -> Both systems on the same network system (both are set to static ip's)
    File Sharing -> File sharing on Mac is enabled
    SMB and AFB -> Are both enabled
    User -> User on the account is enabled for SMB and AFP
    Folder and Files -> Are set to the User
    I think above is set correctly. Just wondering why in my Windows 7 network screen I just see the printers on the Mac and not all the folders I have set to view?
    Thanks JR

    Hello
    Found the issue. The permissions were set incorrectly on the files and folders.
    JR

  • Problem with file upload in JDeveloper 10.1.2 version

    Hi,
    My application is running in JDveloper 10.1.2.1 version with BC4J Struts. Now, I want to do a module with file upload. I am getting an error in the uploading section as
    java.lang.NullPointerException
    at oracle.jbo.html.struts11.MultipartUtil.populate(MultipartUtil.java:227)
    at oracle.jbo.html.struts11.BC4JRequestProcessor.processPopulate(BC4JRequestProcessor.java:433)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:673)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:340)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    at java.lang.Thread.run(Thread.java:534)
    Please suggest me an option to resolve the issue.
    Regards,
    Jobz....

    I remember that there was a bug in the MultipartHandler of the BC4JRequestProcessor in one of the 10.1.2.x version, however I'm nit sure which one. I found the old fix we implemented back then
    Try this request processor and see if this helps:
    package xx.yy.zz.common;
    import javax.servlet.http.HttpServletResponse;
    import oracle.jbo.html.struts11.BC4JActionMapping;
    import org.apache.struts.Globals;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.upload.MultipartRequestHandler;
    import org.apache.struts.upload.MultipartRequestWrapper;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import oracle.jbo.html.HtmlServices;
    import oracle.jbo.html.struts11.BC4JRequestProcessor;
    import oracle.jbo.html.struts11.MultipartUtil;
    * RequestProcessor for Apache Struts based applicartions
    * Fix for a bug in <code>BC4JRequestProcessor</code> Multipart-Requests (e.g. Upload).
    * @projekt common
    public class HvbgBC4JRequestProcessor extends BC4JRequestProcessor {
         * Override to fix a bug. Note that this works only if all ActionMappings in the project
         * are of the type BC4JActionMapping.
         * @see oracle.jbo.html.struts11.BC4JRequestProcessor#processMultipart(HttpServletRequest) processMultipart
        protected HttpServletRequest processMultipart(HttpServletRequest request)
            // Overide only if the action mapping is a BC4JActionMapping.
            BC4JActionMapping mapping = (BC4JActionMapping) request.getAttribute(Globals.MAPPING_KEY);
            if (HtmlServices.isMultipartPost(request)) {
                MultipartRequestHandler handler = MultipartUtil.retrieveMultipartHandler(request);
                if (handler == null) {
                    try {
                        request = MultipartUtil.parseMultipartRequest(request, servlet);
                    catch (ServletException se) {
                        throw new RuntimeException(se.getMessage());
                else {
                    // This is a forward from a Multipart Post upload
                    if (!(request instanceof MultipartRequestWrapper)) {
                        request = new MultipartRequestWrapper(request);
                        MultipartUtil.setWrapperParams(handler, (MultipartRequestWrapper) request);
                    else {
                        // do nothing
            return (request);
    Don't forget to set this new class in your struts-config.xml file!
    Timo

  • Newbie : memory problem with file uploading

    Hello
    I'm exdending a web app based on jsf and , being new to it and java in general, i'm having a problem with file uploading.
    The customer needs to upload large file (more than 30 MB). The application accomplish this using a fileupload component, to let the user select the file, and passing the array of bytes to a web service method.
    I'm using netbeans 6, tomcat 5.5.
    When i try to upload a file too large i got an outofmemory on the local tomcat. So i've rised jvm memory and going on with tests i've found that growing the size i got an http 500 error from the service (the developer of the service has found an out of memory too ).
    I think the service is not modifiable, so i were asking if threre were a way to optimize the file uploading process (a component, a library, a pattern ...) or my only chioice is to rise available memory on both sides.
    I've notice the wsdl declares as base64binary type the data parameter , while netbeans 6 generates a client proxy with a byte[] parameter. Is correct or is a netbeans problem?
    searching with google i've found few thing i haven't fully understood due to my lack of experience:
    the mtom , how can evaluate if it's suitable to help in my problem (i suppose it involves more the web service rather than the client)
    something about the size of a soap body.
    thank you in advance
    Stefano

    Which component exactly are you using? Declaring the stream as a raw byte[] is certainly not efficient. Write code yourself, don't let it autogenerate.
    I can highly recommend you the Tomahawk t:inputFileUpload component. It is easy to integrate in Mojarra. You can find here an useful article: [http://balusc.blogspot.com/2008/02/uploading-files-with-jsf.html].

  • Problem with File Uploading.

    Hi,
    I have one problem with File Upload component.
    JSP
    <ui:upload binding="#{NewProblem.fileUpload1}" columns="#{SessionBean1.uploadedFile}" id="fileUpload1" labelLevel="3"
    style="left: 24px; top: 24px; position: absolute" validator="#{NewProblem.fileUpload1_validate}"/>
    Java
    UploadedFile uploadedFile = getSessionBean1().getUploadedFile();
    Variable uploadedFile is NULL :(((((((((((
    web.xml
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
    </context-param>
    <filter>
    <filter-name>UploadFilter</filter-name>
    <filter-class>com.sun.web.ui.util.UploadFilter</filter-class>
    <init-param>
    <param-name>maxSize</param-name>
    <param-value>10000000</param-value>
    </init-param>
    <init-param>
    <param-name>sizeThreshold</param-name>
    <param-value>10024</param-value>
    </init-param>
    </filter>
    Thanks.

    check out the fileUpload article
    Using the File Upload Component
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/file_upload.html

  • Pb with file upload.

              Hello,
              we do have a problem with file upload ! We're using the o'reilly class, but every
              time we add ENCTYPE="multipart/formdata" in the html, we're unable to correctly get
              the request. ?
              any idea ? Is there something to configure ?
              thx
              

              The request is in the form of multipart data and is parsed by the
              Oreilly class only. To access other information from the request
              the Oreilly class has provided you with the methods for getting
              the other data. You have to access the data from the request using
              the Oreilly class methods
              "Cameron Purdy" <[email protected]> wrote:
              >Be careful what methods you call on the request object.
              > They can prevent
              >you from later asking for that all-important input stream.
              >
              >--
              >Cameron Purdy
              >Tangosol, Inc.
              >http://www.tangosol.com
              >+1.617.623.5782
              >WebLogic Consulting Available
              >
              >
              >"Laurent Andre" <[email protected]> wrote
              >in message
              >news:3a88184c$[email protected]..
              >>
              >> Hello,
              >>
              >> we do have a problem with file upload ! We're using
              >the o'reilly class,
              >but every
              >> time we add ENCTYPE="multipart/formdata" in the html,
              >we're unable to
              >correctly get
              >> the request. ?
              >> any idea ? Is there something to configure ?
              >>
              >> thx
              >>
              >
              >
              

  • Help with ftp upload problem

    Hi I am using a ftp class (known as FTPConnection) that i found on this site: http://www.nsftools.com/tips/JavaFtp.htm , and they only have an example of how to download a File through FTP and not upload one. I am in the proccess of making an FTP upload applet, and need some help on getting upload to work. I also need it to work on both a Pc and mac, so that may be attributing to the problem becuase i am currently on a mac which uses file:// instead of C:\\. Ill post the ftp class, and a snippet of my code that tries to upload a selected file.
    FTPConnection
    /* <!-- in case someone opens this in a browser... --> <pre> */
    * File:   FTPConnection.java
    * Author: Bret Taylor <[email protected]>
    * URL: http://www.stanford.edu/~bstaylor/cs/ftpconnection/FTPConnection.java.shtml
    * see also <a href="http://www.nsftools.com/tips/JavaFtp.htm">http://www.nsftools.com/tips/JavaFtp.htm</a>
    * $Id$
    * Parts of this code were adopted from a variety of other FTP classes the
    * author has encountered that he was not completely satisfied with.  If you
    * think more thanks are due to any particular author than is given, please
    * let him know.  With that caveat, this class can be freely distributed and
    * modified as long as Bret Taylor is given credit in the source code comments.
    * Modified by Julian Robichaux -- http://www.nsftools.com
    * Added constructors, logout(), listFiles(), listSubdirectories(), getAndParseDirList(),
    * processFileListCommand(), and overloaded getFullServerReply().
    * Also added StringBuffer parameter options to transferData() and executeDataCommand()
    * and did a few other little things.
    import java.io.*;
    import java.net.*;
    import java.util.*;
    * <p>A wrapper for the network and command protocols needed for the most common
    * FTP commands.  Standard usage looks something like this:</p>
    * <pre> FTPConnection connection = new FTPConnection();
    * try {
    *     if (connection.connect(host)) {
    *         if (connection.login(username, password)) {
    *             connection.downloadFile(serverFileName);
    *             connection.uploadFile(localFileName);
    *         connection.disconnect();
    * } catch (UnknownHostException e) {
    *     // handle unknown host
    * } catch (IOException e) {
    *     // handle I/O exception
    * }</pre>
    * <p>Most FTP commands are wrapped by easy-to-use methods, but in case clients
    * need more flexibility, you can execute commands directly using the methods
    * <a href="#executeCommand(java.lang.String)">executeCommand</a> and
    * <a href="#executeDataCommand(java.lang.String,
    * java.io.OutputStream)">executeDataCommand</a>,
    * the latter of which is used for commands that require an open data port.</p>
    * @author Bret Taylor
    * @author Julian Robichaux
    * @version 1.01
    public class FTPConnection extends Object {
         * If this flag is on, we print out debugging information to stdout during
         * execution.  Useful for debugging the FTP class and seeing the server's
         * responses directly.
        private static boolean PRINT_DEBUG_INFO = false;
         * The socket through which we are connected to the FTP server.
        private Socket connectionSocket = null;
         private String username;
         private String password;
         private String host;
         * The socket output stream.
        private PrintStream outputStream = null;
         * The socket input stream.
        private BufferedReader inputStream = null;
         * The offset at which we resume a file transfer.
        private long restartPoint = 0L;
         * Added by Julian: If this flag is on, we're currently logged in to something.
        private boolean loggedIn = false;
         * Added by Julian: This is the line terminator to use for multi-line responses.
        public String lineTerm = "\n";
         * Added by Julian: This is the size of the data blocks we use for transferring
         * files.
        private static int BLOCK_SIZE = 4096;
         * Added by Julian: After you create an FTPConnection object, you will call the
         * connect() and login() methods to access your server. Please don't forget to
         * logout() and disconnect() when you're done (it's only polite...).
        public FTPConnection ()
             // default constructor (obviously) -- this is just good to have...
         * Added by Julian: Allows you to specify if you want to send debug output to
         * the console (true if you do, false if you don't).
        public FTPConnection (boolean debugOut)
             PRINT_DEBUG_INFO = debugOut;
         public FTPConnection (String user, String pw, String host_)
             username=user;
              password=pw;
              host=host_;
              PRINT_DEBUG_INFO = false;
         * Prints debugging information to stdout if the private flag
         * <code>PRINT_DEBUG_INFO</code> is turned on.
        private void debugPrint(String message) {
            if (PRINT_DEBUG_INFO) System.err.println(message);
         * Connects to the given FTP host on port f, the default FTP port.
        public boolean connect(String host)
            throws UnknownHostException, IOException
            return connect(host, 21);
         * Connects to the given FTP host on the given port.
        public boolean connect(String host, int port)
            throws UnknownHostException, IOException
            connectionSocket = new Socket(host, port);
              connectionSocket.setSoTimeout(10000);
            outputStream = new PrintStream(connectionSocket.getOutputStream());
            inputStream = new BufferedReader(new
                           InputStreamReader(connectionSocket.getInputStream()));
            if (!isPositiveCompleteResponse(getServerReply())){
                disconnect();
                return false;
            return true;
         * Disconnects from the host to which we are currently connected.
         static boolean URLexists(String URLName)
              try
                   HttpURLConnection.setFollowRedirects(false);
                   // note : you may also need
                   // HttpURLConnection.setInstanceFollowRedirects(false)
                   HttpURLConnection con =
                   (HttpURLConnection) new URL(URLName).openConnection();
                   con.setRequestMethod("HEAD");
                   return (con.getResponseCode() == HttpURLConnection.HTTP_OK);
              catch (Exception e)
                   e.printStackTrace();
                   return false;
         public String getSimpleFileName(File f)
              String path=f.getPath();
              String fileName=path.replace("\\", "/");
              int slashPos = fileName.lastIndexOf("/");
              fileName=fileName.substring(slashPos+1);
              return fileName;
         public String verifyFileName(String name)
              int count=0;
              //String url="http://chris-malcolm.com/images/"+URLEncoder.encode(name).replace("+", "%20");
              while (URLexists("http://chris-malcolm.com/images/"+URLEncoder.encode(name).replace("+", "%20"))==true)
              count++;
              name=FileExt(name)[0]+"-"+count+"."+FileExt(name)[1];
              return name;
         public String[] FileExt(String fileName)
            int dotPos = fileName.lastIndexOf(".");
              fileName=fileName.replace("\\", "/");
              int slashPos = fileName.lastIndexOf("/");
              String extension, name;
              if (slashPos==fileName.length()-1)
                   fileName=fileName.substring(0, fileName.length()-1);
                   slashPos=fileName.lastIndexOf("/");
                   extension="/";
                   name=fileName.substring(slashPos+1);
              else if(dotPos==-1)
                   name=fileName.substring(slashPos+1);
                   extension="";
              else
                   extension = fileName.substring(dotPos+1);
                   name=fileName.substring(slashPos+1, dotPos);
                   String[] output={name, extension};
                   return output;
              String[] output={name, extension};
              return output;
        public void disconnect()
            if (outputStream != null) {
                try {
                      if (loggedIn) { logout(); };
                    outputStream.close();
                    inputStream.close();
                    connectionSocket.close();
                } catch (IOException e) {}
                outputStream = null;
                inputStream = null;
                connectionSocket = null;
         * Wrapper for the commands <code>user [username]</code> and <code>pass
         * [password]</code>.
        public boolean login(String username, String password)
            throws IOException
            int response = executeCommand("user " + username);
            if (!isPositiveIntermediateResponse(response)) return false;
            response = executeCommand("pass " + password);
            loggedIn = isPositiveCompleteResponse(response);
            return loggedIn;
         * Added by Julian: Logout before you disconnect (this is good form).
        public boolean logout()
            throws IOException
            int response = executeCommand("quit");
            loggedIn = !isPositiveCompleteResponse(response);
            return !loggedIn;
         * Wrapper for the command <code>cwd [directory]</code>.
        public boolean changeDirectory(String directory)
            throws IOException
            int response = executeCommand("cwd " + directory);
            return isPositiveCompleteResponse(response);
         * Wrapper for the commands <code>rnfr [oldName]</code> and <code>rnto
         * [newName]</code>.
        public boolean renameFile(String oldName, String newName)
            throws IOException
            int response = executeCommand("rnfr " + oldName);
            if (!isPositiveIntermediateResponse(response)) return false;
            response = executeCommand("rnto " + newName);
            return isPositiveCompleteResponse(response);
         * Wrapper for the command <code>mkd [directory]</code>.
        public boolean makeDirectory(String directory)
            throws IOException
            int response = executeCommand("mkd " + directory);
            return isPositiveCompleteResponse(response);
         * Wrapper for the command <code>rmd [directory]</code>.
        public boolean removeDirectory(String directory)
            throws IOException
            int response = executeCommand("rmd " + directory);
            return isPositiveCompleteResponse(response);
         * Wrapper for the command <code>cdup</code>.
        public boolean parentDirectory()
            throws IOException
            int response = executeCommand("cdup");
            return isPositiveCompleteResponse(response);
         * Wrapper for the command <code>dele [fileName]</code>.
        public boolean deleteFile(String fileName)
            throws IOException
            int response = executeCommand("dele " + fileName);
            return isPositiveCompleteResponse(response);
         * Wrapper for the command <code>pwd</code>.
        public String getCurrentDirectory()
            throws IOException
            String response = getExecutionResponse("pwd");
            StringTokenizer strtok = new StringTokenizer(response);
            // Get rid of the first token, which is the return code
            if (strtok.countTokens() < 2) return null;
            strtok.nextToken();
            String directoryName = strtok.nextToken();
            // Most servers surround the directory name with quotation marks
            int strlen = directoryName.length();
            if (strlen == 0) return null;
            if (directoryName.charAt(0) == '\"') {
                directoryName = directoryName.substring(1);
                strlen--;
            if (directoryName.charAt(strlen - 1) == '\"')
                return directoryName.substring(0, strlen - 1);
            return directoryName;
         * Wrapper for the command <code>syst</code>.
        public String getSystemType()
            throws IOException
            return excludeCode(getExecutionResponse("syst"));
         * Wrapper for the command <code>mdtm [fileName]</code>.  If the file does
         * not exist, we return -1;
        public long getModificationTime(String fileName)
            throws IOException
            String response = excludeCode(getExecutionResponse("mdtm " + fileName));
            try {
                return Long.parseLong(response);
            } catch (Exception e) {
                return -1L;
         * Wrapper for the command <code>size [fileName]</code>.  If the file does
         * not exist, we return -1;
        public long getFileSize(String fileName)
            throws IOException
            String response = excludeCode(getExecutionResponse("size " + fileName));
            try {
                return Long.parseLong(response);
            } catch (Exception e) {
                return -1L;
         * Wrapper for the command <code>retr [fileName]</code>.
        public boolean downloadFile(String fileName)
            throws IOException
            return readDataToFile("retr " + fileName, fileName);
         * Wrapper for the command <code>retr [serverPath]</code>. The local file
         * path to which we will write is given by <code>localPath</code>.
        public boolean downloadFile(String serverPath, String localPath)
            throws IOException
            return readDataToFile("retr " + serverPath, localPath);
         * Wrapper for the command <code>stor [fileName]</code>.
        public boolean uploadFile(String fileName)
            throws IOException
            return writeDataFromFile("stor " + fileName, fileName);
         * Wrapper for the command <code>stor [localPath]</code>. The server file
         * path to which we will write is given by <code>serverPath</code>.
        public boolean uploadFile(String serverPath, String localPath)
            throws IOException
            return writeDataFromFile("stor " + serverPath, localPath);
         * Set the restart point for the next download or upload operation.  This
         * lets clients resume interrupted uploads or downloads.
        public void setRestartPoint(int point)
            restartPoint = point;
            debugPrint("Restart noted");
         * Gets server reply code from the control port after an ftp command has
         * been executed.  It knows the last line of the response because it begins
         * with a 3 digit number and a space, (a dash instead of a space would be a
         * continuation).
        private int getServerReply()
            throws IOException
            return Integer.parseInt(getFullServerReply().substring(0, 3));
         * Gets server reply string from the control port after an ftp command has
         * been executed.  This consists only of the last line of the response,
         * and only the part after the response code.
        private String getFullServerReply()
            throws IOException
            String reply;
            do {
                reply = inputStream.readLine();
                debugPrint(reply);
            } while(!(Character.isDigit(reply.charAt(0)) &&
                      Character.isDigit(reply.charAt(1)) &&
                      Character.isDigit(reply.charAt(2)) &&
                      reply.charAt(3) == ' '));
            return reply;
         * Added by Julian: Returns the last line of the server reply, but also
         * returns the full multi-line reply in a StringBuffer parameter.
        private String getFullServerReply(StringBuffer fullReply)
             throws IOException
            String reply;
            fullReply.setLength(0);
            do {
                reply = inputStream.readLine();
                debugPrint(reply);
                fullReply.append(reply + lineTerm);
            } while(!(Character.isDigit(reply.charAt(0)) &&
                      Character.isDigit(reply.charAt(1)) &&
                      Character.isDigit(reply.charAt(2)) &&
                      reply.charAt(3) == ' '));
              // remove any trailing line terminators from the fullReply
              if (fullReply.length() > 0) 
                   fullReply.setLength(fullReply.length() - lineTerm.length());
            return reply;
         * Added by Julian: Gets a list of files in the current directory.
         public String listFiles()
              throws IOException
              return listFiles("");
         * Added by Julian: Gets a list of files in either the current
         * directory, or one specified as a parameter. The 'params' parameter
         * can be either a directory name, a file mask, or both (such as
         * '/DirName/*.txt').
         public String listFiles(String params)
              throws IOException
              StringBuffer files = new StringBuffer();
              StringBuffer dirs = new StringBuffer();
              if (!getAndParseDirList(params, files, dirs))
                   debugPrint("Error getting file list");
              return files.toString();
         * Added by Julian: Gets a list of subdirectories in the current directory.
         public String listSubdirectories()
              throws IOException
              return listSubdirectories("");
         * Added by Julian: Gets a list of subdirectories in either the current
         * directory, or one specified as a parameter. The 'params' parameter
         * can be either a directory name, a name mask, or both (such as
         * '/DirName/Sub*').
         public String listSubdirectories(String params)
              throws IOException
              StringBuffer files = new StringBuffer();
              StringBuffer dirs = new StringBuffer();
              if (!getAndParseDirList(params, files, dirs))
                   debugPrint("Error getting dir list");
              return dirs.toString();
         * Added by Julian: Sends and gets the results of a file list command,
         * like LIST or NLST.
        private String processFileListCommand(String command)
            throws IOException
            StringBuffer reply = new StringBuffer();
            String replyString;
            // file listings require you to issue a PORT command,
            // like a file transfer
              boolean success = executeDataCommand(command, reply);
              if (!success)
                   return "";
            replyString = reply.toString();
            // strip the trailing line terminator from the reply
            if (reply.length() > 0)
                 return replyString.substring(0, reply.length() - 1);
            }  else  {
                 return replyString;
          * Added by Julian: Gets a directory list from the server and parses
          * the elements into a list of files and a list of subdirectories.
         private boolean getAndParseDirList(String params, StringBuffer files, StringBuffer dirs)
              throws IOException
              // reset the return variables (we're using StringBuffers instead of
              // Strings because you can't change a String value and pass it back
              // to the calling routine -- changing a String creates a new object)
              files.setLength(0);
              dirs.setLength(0);
              // get the NLST and the LIST -- don't worry if the commands
              // don't work, because we'll just end up sending nothing back
              // if that's the case
              String shortList = processFileListCommand("nlst " + params);
              String longList = processFileListCommand("list " + params);
              // tokenize the lists we got, using a newline as a separator
              StringTokenizer sList = new StringTokenizer(shortList, "\n");
              StringTokenizer lList = new StringTokenizer(longList, "\n");
              // other variables we'll need
              String sString;
              String lString;
              // assume that both lists have the same number of elements
              while ((sList.hasMoreTokens()) && (lList.hasMoreTokens())) {
                   sString = sList.nextToken();
                   lString = lList.nextToken();
                   if (lString.length() > 0)
                        if (lString.startsWith("d"))
                             dirs.append(sString.trim() + lineTerm);
                             debugPrint("Dir: " + sString);
                        }  else if (lString.startsWith("-"))  {
                             files.append(sString.trim() + lineTerm);
                             debugPrint("File: " + sString);
                        }  else  {
                             // actually, symbolic links will start with an "l"
                             // (lowercase L), but we're not going to mess with
                             // those
                             debugPrint("Unknown: " + lString);
              // strip off any trailing line terminators and return the values
              if (files.length() > 0)  {  files.setLength(files.length() - lineTerm.length());  }
              if (dirs.length() > 0)  {  dirs.setLength(dirs.length() - lineTerm.length());  }
              return true;
         * Executes the given FTP command on our current connection, returning the
         * three digit response code from the server.  This method only works for
         * commands that do not require an additional data port.
        public int executeCommand(String command)
            throws IOException
            outputStream.println(command);
            return getServerReply();
         * Executes the given FTP command on our current connection, returning the
         * last line of the server's response.  Useful for commands that return
         * one line of information.
        public String getExecutionResponse(String command)
            throws IOException
            outputStream.println(command);
            return getFullServerReply();
         * Executes the given ftpd command on the server and writes the results
         * returned on the data port to the file with the given name, returning true
         * if the server indicates that the operation was successful.
        public boolean readDataToFile(String command, String fileName)
            throws IOException
            // Open the local file
            RandomAccessFile outfile = new RandomAccessFile(fileName, "rw");
            // Do restart if desired
            if (restartPoint != 0) {
                debugPrint("Seeking to " + restartPoint);
                outfile.seek(restartPoint);
            // Convert the RandomAccessFile to an OutputStream
            FileOutputStream fileStream = new FileOutputStream(outfile.getFD());
            boolean success = executeDataCommand(command, fileStream);
            outfile.close();
            return success;
         * Executes the given ftpd command on the server and writes the contents
         * of the given file to the server on an opened data port, returning true
         * if the server indicates that the operation was successful.
        public boolean writeDataFromFile(String command, String fileName)
            throws IOException
            // Open the local file
            RandomAccessFile infile = new RandomAccessFile(fileName, "r");
            // Do restart if desired
            if (restartPoint != 0) {
                debugPrint("Seeking to " + restartPoint);
                infile.seek(restartPoint);
            // Convert the RandomAccessFile to an InputStream
            FileInputStream fileStream = new FileInputStream(infile.getFD());
            boolean success = executeDataCommand(command, fileStream);
            infile.close();
            return success;
         * Executes the given ftpd command on the server and writes the results
         * returned on the data port to the given OutputStream, returning true
         * if the server indicates that the operation was successful.
        public boolean executeDataCommand(String command, OutputStream out)
            throws IOException
            // Open a data socket on this computer
            ServerSocket serverSocket = new ServerSocket(0);
            if (!setupDataPort(command, serverSocket)) return false;
            Socket clientSocket = serverSocket.accept();
            // Transfer the data
            InputStream in = clientSocket.getInputStream();
            transferData(in, out);
            // Clean up the data structures
            in.close();
            clientSocket.close();
            serverSocket.close();
            return isPositiveCompleteResponse(getServerReply());   
         * Executes the given ftpd command on the server and writes the contents
         * of the given InputStream to the server on an opened data port, returning
         * true if the server indicates that the operation was successful.
        public boolean executeDataCommand(String command, InputStream in)
            throws IOException
            // Open a data socket on this computer
            ServerSocket serverSocket = new ServerSocket(0);
            if (!setupDataPort(command, serverSocket)) return false;
            Socket clientSocket = serverSocket.accept();
            // Transfer the data
            OutputStream out = clientSocket.getOutputStream();
            transferData(in, out);
            // Clean up the data structures
            out.close();
            clientSocket.close();
            serverSocket.close();
            return isPositiveCompleteResponse(getServerReply());   
         * Added by Julian: Executes the given ftpd command on the server
         * and writes the results returned on the data port to the given
         * StringBuffer, returning true if the server indicates that the
         * operation was successful.
        public boolean executeDataCommand(String command, StringBuffer sb)
            throws IOException
            // Open a data socket on this computer
            ServerSocket serverSocket = new ServerSocket(0);
            if (!setupDataPort(command, serverSocket)) return false;
            Socket clientSocket = serverSocket.accept();
            // Transfer the data
            InputStream in = clientSocket.getInputStream();
            transferData(in, sb);
            // Clean up the data structures
            in.close();
            clientSocket.close();
            serverSocket.close();
            return isPositiveCompleteResponse(getServerReply());   
         * Transfers the data from the given input stream to the given output
         * stream until we reach the end of the stream.
        private void transferData(InputStream in, OutputStream out)
            throws IOException
            byte b[] = new byte[BLOCK_SIZE];
            int amount;
            // Read the data into the file
            while ((amount = in.read(b)) > 0) {
                out.write(b, 0, amount);
         * Added by Julian: Transfers the data from the given input stream
         * to the given StringBuffer until we reach the end of the stream.
        private void transferData(InputStream in, StringBuffer sb)
            throws IOException
            byte b[] = new byte[BLOCK_SIZE];
            int amount;
            // Read the data into the StringBuffer
            while ((amount = in.read(b)) > 0) {
                sb.append(new String(b, 0, amount));
         * Executes the given ftpd command on the server and writes the results
         * returned on the data port to the given FilterOutputStream, returning true
         * if the server indicates that the operation was successful.
        private boolean setupDataPort(String command, ServerSocket serverSocket)
            throws IOException
            // Send our local data port to the server
            if (!openPort(serverSocket)) return false;
            // Set binary type transfer
            outputStream.println("type i");
            if (!isPositiveCompleteResponse(getServerReply())) {
                debugPrint("Could not set transfer type");
                return false;
            // If we have a restart point, send that information
            if (restartPoint != 0) {
                outputStream.println("rest " + restartPoint);
                restartPoint = 0;
                // TODO: Interpret server response here
                getServerReply();
            // Send the command
            outputStream.println(command);
            return isPositivePreliminaryResponse(getServerReply());
         * Get IP address and port number from serverSocket and send them via the
         * <code>port</code> command to the ftp server, returning true if we get a
         * valid response from the server, returning true if the server indicates
         * that the operation was successful.
        private boolean openPort(ServerSocket serverSocket)
            throws IOException
            int localport = serverSocket.getLocalPort();
            // get local ip address
            InetAddress inetaddress = serverSocket.getInetAddress();
            InetAddress localip;
            try {
                localip = inetaddress.getLocalHost();
            } catch(UnknownHostException e) {
                debugPrint("Can't get local host");
                return false;
            // get ip address in high byte order
            byte[] addrbytes = localip.getAddress();
            // tell server what port we are listening on
            short addrshorts[] = new short[4];
            // problem:  bytes greater than 127 are printed as negative numbers
            for(int i = 0; i <= 3; i++) {
                addrshorts[i] = addrbytes;
    if (addrshorts[i] < 0)
    addrshorts[i] += 256;
    outputStream.println("port " + addrshorts[0] + "," + addrshorts[1] +
    "," + addrshorts[2] + "," + addrshorts[3] + "," +
    ((localport & 0xff00) >> 8) + "," +
    (localport & 0x00ff));
    return isPositiveCompleteResponse(getServerReply());
    * True if the given response code is in the 100-199 range.
    private boolean isPositivePreliminaryResponse(int response)
    return (response >= 100 && response < 200);
    * True if the given response code is in the 300-399 range.
    private boolean isPositiveIntermediateResponse(int response)
    return (response >= 300 && response < 400);
    * True if the given response code is in the 200-299 range.
    private boolean isPositiveCompleteResponse(int response)
    return (response >= 200 && response < 300);
    * True if the given response code is in the 400-499 range.
    private boolean isTransientNegativeResponse(int response)
    return (response >= 400 && response < 500);
    * True if the given response code is in the 500-5

    ok i tried explaining th eproblem in the previous post, but i apologize if my explanation was poor. anyways, i tried to look into it further by doing a printStackTrace() and believe it may be a read error. here is my new updated snippet, and also a link to a screenshot ([click here for screenshot|http://img143.imageshack.us/my.php?image=picture4qr0.png]) of what the error looks like on my end. it seems like a socket is not being read, or maybe it is initialized properly. Again I apologize if my problem is vague, but I do appreciate your input. thanks.
    updated code snippet
    public void uploadFiles()
              statusLabel.setVisible(true);
              errorLabel.setVisible(true);
              uploadButton.setVisible(false);
              footer.setVisible(false);
              holdingPanel.setVisible(false);
              pbar.setVisible(true);
              pbar = new JProgressBar();
              pbar.setMinimum(0);
              float Total=0;
              for (int i=0; i<fileLengths.size(); i++)
                   if(((java.lang.Boolean)model.getValueAt(i,1)).toString().equals("true"))
                        Total+=Float.parseFloat((String)fileLengths.get(i));
              pbar.setMaximum((int)Total);
              String info="";
              try
                   ftp=new FTPConnection(false);
                   ftp.connect("ftp.chris-malcolm.com");
                   if (ftp.login("chrismal", "***"))
                        statusLabel.setText("Status: Connected.");
                        info+="Successfully logged in!\n";
                        info+="System type is: " + ftp.getSystemType()+"\n";
                        info+="Current directory is: " + ftp.getCurrentDirectory()+"\n";
                        if (ftp.changeDirectory("/www/images/"))
                             info+="directory changed to: " + ftp.getCurrentDirectory()+"\n";
                                                 try
                             for (int i=0; i<allFiles.size(); i++)
                                  if(((java.lang.Boolean)model.getValueAt(i,1)).toString().equals("true"))
                                       String f=client.verifyFileName((String)model.getValueAt(i,0));
                                       String f2=""+((File)allFiles.get(i)).getPath();
                                       info+="filename: "+f2+"\n";
                                       if (ftp.uploadFile(f2))
                                            statusLabel.setText("Status: Uploading "+f+" - "+i+" of "+calculateTotalFiles()+" files(s)");
                                            pbar.setValue(Integer.parseInt((String)fileLengths.get(i)));
                                       else
                                            errorLabel.setText("Error occured while uploading"+f2+"\n");
                        catch(Exception de) 
                             StringWriter sw = new StringWriter();
                                  PrintWriter pw = new PrintWriter(sw);
                                  de.printStackTrace(pw);
                                  pw.close();
                                  //errorLabel.setText("<html>ERROR:"+sw.toString().replace("\n", "<br>")+"</html>");
                                  info+="Error: "+de.getMessage()+"\n";
                                  info+="Trace: "+sw+"\n";
                             try { ftp.disconnect(); statusLabel.setText("Status: disconnected.");}  catch(Exception e2)  {};
                        else
                             info+="could not change directory\n";
                   else
                        info+="could not login";
              catch (Exception e)
                   StringWriter sw = new StringWriter();
                                  PrintWriter pw = new PrintWriter(sw);
                                  e.printStackTrace(pw);
                                  pw.close();
                                  info+="Error: "+e.getMessage()+"\n";
                                  info+="Trace: "+sw+"\n";
                   try { ftp.disconnect();  statusLabel.setText("Status: disconnected.");}  catch(Exception e2)  {};
              errorLabel.setText("ERROR:"+info);
              JOptionPane.showMessageDialog(this, info, "test", JOptionPane.PLAIN_MESSAGE);
              try { ftp.disconnect(); statusLabel.setText("Status: disconnected.");}  catch(Exception e2)  {};
         Edited by: cjm771 on Jul 13, 2008 7:23 PM

  • HELP! File Upload Servlet and Internet Explorer

    Hello people. I hope this is an easy problem to solve...
    I have a servlet upload program that works using Mozilla browser (www.mozilla.org), but for some reason it doesn't work using Microsoft IE. The servlet is also using the servlet upload API from Apache (commons).
    I'm using IE version 6.0.2800.1106 in a Win98SE host computer. I get a cannot find path specified error message (see below). At work, I also get the same error message using IE, but don't know what version. The OS is XP. Unfortunately, at work, I can't install Mozilla browser (or any software-company policy) to see if Mozilla works there too. I would've like to have tested to see if the upload program worked on Mozilla on a truly remote computer.
    So I figured, it must be a IE configuration issue, but darn it!! I began by resetting IE to default settings, but still have the problem, I played around with several different combinations of settings in "Tools"-->"Internet Options...", and I still get the error message. Someone PLEASE HELP ME!!!
    Dunno, if it will help, I've also pasted the upload servlet source code below and the html file that's calling the upload servlet, but you still need the Apache commons file upload API.
    Trust me on this one folks, for some reason it works for Mozilla, but not for IE. With IE, I can at least access web server, and therefore, the html file that calls the upload servlet , so I don't think it's a Tomcat configuration issue (version 5.0). I actually got the code for the file upload servlet from a book relatively new in the market (printed in 2003), and it didn't mention any limitations as far as what browser to use or any browser configuration requirements. I have e-mailed the authors, but they probably get a ton of e-mails...
    Anyone suggestions?
    Meanwhile, I will try to install other free browsers and see if the file upload program works for them too.
    ERROR MESSAGE:
    "HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: C:\TOMCAT\webapps\MyWebApps\files\C:\WINDOWS\Desktop\myfile.zip (The system cannot find the path specified)
         com.jspbook.FileUploadCommons.doPost(FileUploadCommons.java:43)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    root cause
    java.io.FileNotFoundException: C:\TOMCAT\webapps\MyWebApp\files\C:\WINDOWS\Desktop\myfile.zip (The system cannot find the path specified)
         java.io.FileOutputStream.open(Native Method)
         java.io.FileOutputStream.(FileOutputStream.java:176)
         java.io.FileOutputStream.(FileOutputStream.java:131)
         org.apache.commons.fileupload.DefaultFileItem.write(DefaultFileItem.java:392)
         com.jspbook.FileUploadCommons.doPost(FileUploadCommons.java:36)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    note The full stack trace of the root cause is available in the Tomcat logs.
    Apache Tomcat 5.0.16"
    FILE UPLOAD SERVLET source code:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import org.apache.commons.fileupload.*;
    import java.util.*;
    public class FileUploadCommons extends HttpServlet {
    public void doPost(HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.print("File upload success. <a href=\"/MyWebApp/files/");
    out.print("\">Click here to browse through all uploaded ");
    out.println("files.</a><br>");
    ServletContext sc = getServletContext();
    String path = sc.getRealPath("/files");
    org.apache.commons.fileupload.DiskFileUpload fu = new
    org.apache.commons.fileupload.DiskFileUpload();
    fu.setSizeMax(-1);
    fu.setRepositoryPath(path);
    try {
    List l = fu.parseRequest(request);
    Iterator i = l.iterator();
    while (i.hasNext()) {
    FileItem fi = (FileItem)i.next();
    fi.write(new File(path, fi.getName()));
    catch (Exception e) {
    throw new ServletException(e);
    out.println("</html>");
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException {
    doPost(request, response);
    HTML PAGE that calls the upload servlet:
    <html>
    <head>
    <title>Example HTML Form</title>
    </head>
    <body>
    <p>Select a file to upload or browse
    currently uploaded files.</p>
    <form action="http://##.##.##.####/MyWebApp/FileUploadCommons"
    method="post" enctype="multipart/form-data">
    File: <input type="file" name="file"><br>
    <input value="Upload File" type="submit">
    </form>
    </body>
    </html>
    Thanks in advance for any assistance.
    -Dan

    I'm guessing what is happening is that Mozilla tells the servlet "here comes the file myfile.zip". The servlet builds a file name for it:
        String path = sc.getRealPath("/files");
        // path is now C:\TOMCAT\webapps\MyWebApps\files\
        fi.write(new File(path, fi.getName()));
        // append myfile.zip to "path", making it C:\TOMCAT\webapps\MyWebApps\files\myfile.zipIE, however, tells "here comes the file C:\WINDOWS\Desktop\myfile.zip". Now imagine what the path+filename ends up being...
    So what you want to do is something along the lines of (assuming Windoze):
    public static String basename(String filename)
        int slash = filename.lastIndexOf("\\");
        if (slash != -1)
            filename = filename.substring(slash + 1);
        // I think Windows doesn't like /'s either
        int slash = filename.lastIndexOf("/");
        if (slash != -1)
            filename = filename.substring(slash + 1);
        // In case the name is C:foo.txt
        int slash = filename.lastIndexOf(":");
        if (slash != -1)
            filename = filename.substring(slash + 1);
        return filename;
        fi.write(new File(path, basename(fi.getName()));
        ....You can make the file name check more bomb proof if security is an issue. Long file names trying to overflow something in the OS, NUL characters, Unicode, forbidden names in Windos (con, nul, ...), missing file name, ...

  • Need Urgent Help with Apache and PHP

    I have been struggling with apache and php for a week now and I finally broke down to post a message.
    I have apache 1.3 running on my mac mini g4 with 10.4.9 and I installed sql. I went to the entropy website and downloaded php5 to install without knowing I already had php4 on the machine. I installed 5 but could not get it to work. I then went back to httpd.conf and tried to install php4 by uncommenting out the loadmodule and addmodule lines. I restarted apache but php still did not work. I tested the phpinfo.php script but all I got was the script in Safari and not the actual page. At the moment, I have php4 and php5 on my machine but can't get either one to work. I am sure there is an easy fix but I don't know it. Please help.

    The problem is not terribly complicated, but Apache will not start with the entropy file in the folder
    /etc/httpd/users/
    Let me experiment on you. Rename the entropy file and then try to start Apache. To do this, open Terminal and paste this command:
    <pre>sudo mv /etc/httpd/users/+entropy.conf /etc/httpd/users/+entropy<pre>
    Now check the Apache configuration:
    <pre>apachectl configtest<pre>
    If it says "Syntax OK", start Apache:
    <pre>sudo apachectl start<pre>
    Since we only disabled the entropy file, you should be able to enable PHP5 with some more advanced configuring.

  • Custom order form with file upload facility

    Hi all,
    I'm trying to create a custom order form(for a printing company) where the user can select their product, enter their credit card details and then upload the file. I've created the combo box & user input text fields. Now what I want is that when user clicks the submit button:
    1. A mail is sent to the admin which contain all the details about the form that was filled by the user.
    2. The file that is uploaded by the user should also be sent as attachment in the same mail. I'm not able to figure out how to add the feature of file upload in ActionScript.
    3. This one is optional, but will add value to me if possible. The website is developed in Wordpress. Can we have a feature where a logged in user can save his order and come again later and retrieve his order form.
    Any help would be appreciated. Thanks for your time.
    Regards,
    Rajeev

    your client is, i believe, legally negligent.  you are probably jointly liable with your client.
    you should try and protect yourself.  you should keep a record that you've informed him that he needs to encrypt all credit card numbers during all phases of transmission but i doubt that will be enough to protect you because you are in a position to know and, will know, that he's not fulfilling his obligations to protect sensitive information.
    you would use the urlloader class to communicate between flash and the server and you will probably use php (another coding language) for the server-side coding.
    you can use google to search for php tutorials and help.

  • Problems with file upload using AMF or SOAP

    We use your AMF to connect Flex with Ruby on Rails.
    Everything is OK, except file upload.
    We did not find how to upload file using AMF or SOAP RPC from
    Flex. Only to use FileReference.upload().
    The problem is that Flex uses different User-Agent in HTTP
    header for this upload and for SOAP/AMF calls.
    This means that sessions are different. And even if you
    authenticated via SOAP/AMF you can not use it to upload file.
    Could you, please, advice is there any other way to upload
    files from Flex via SOAP or AMF?

    Please, help me on this issue, i am still waiting for someone replying me!

Maybe you are looking for