David Powers Lesson09 - no file uploaded

I have a problem to test the upload_test.php. It seems that no file being copied to the destinated folder at all. Enclosed are the 2 files for reference.
Please help me. Thank You
upload_test.php
<?php
require_once('scripts/process_upload.php');
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
<form name="form1" method="post" action="">
  <p>
    <input name="MAX_FILE_SIZE" type="hidden" id="MAX_FILE_SIZE" value="51200">
    <label for="upload_file">File to upload:</label>
    <input type="file" name="upload_file" id="upload_file">
  </p>
  <p>
    <input type="submit" name="upload" id="upload" value="Upload File">
  </p>
</form>
</body>
</html>
process_upload.php
<?php
if (isset($_POST['upload'])) {
  require_once('library.php');
  try {
          $destination = 'C:/upload_test';
          $uploader = new Zend_File_Transfer_Adapter_Http();
          $uploader->setDestination($destination);
          $uploader->receive();
  } catch (Exception $e) {
          echo $e->getMessage();

My upload_tmp_dir folder is exist and file_uploads is set 'On' in my php.ini.
I check error message after uploaded and it showed as 'Array ( [fileUploadErrorIniSize] => File '' exceeds the defined ini size )
My selected file for upload is just 1K in size only. Still the problem exists.

Similar Messages

  • Question for David Powers re file 'quotations.sql'

    It would appear from the first few lines of this file (shown
    below) that it
    first checks if a table "quotations" already exists, and if
    so deletes it. Then
    it creates a new version, and populates it with the following
    data.
    Is this correct?
    Clancy
    -- Table structure for table `quotations`
    DROP TABLE IF EXISTS `quotations`;
    CREATE TABLE `quotations` (
    `quote_id` int(10) unsigned NOT NULL auto_increment,
    `quotation` varchar(255) NOT NULL default '',
    `first_name` varchar(30) NOT NULL default '',
    `family_name` varchar(30) NOT NULL default '',
    PRIMARY KEY (`quote_id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    -- Dumping data for table `quotations`
    INSERT INTO `quotations` VALUES (1, 'My disability is ......'
    Clancy

    Clancy wrote:
    > I thought so. As the sql file redefines the table, is it
    necessary to define
    > the table at all before running the file?
    The purpose of the preceding section is to teach you how to
    define a
    table. If all you're interested in is copying my table
    structure, feel
    free to do so. However, I believe in the principle of
    teaching a man to
    fish, rather than giving a man a fish.
    > I have been thinking about how to set up a database for
    my photo album, and
    > wondering how to order it. If I have a text file, like
    'quotations.sql', it
    > looks as if the easiest way to change the order of the
    photos is to swap the
    > lines in the text file, and then reload the whole
    database.
    If that's your conclusion, then I'm afraid that you have
    failed to
    understand the fundamental principles of how a database
    works. The order
    in which records are entered is totally irrelevant. You use
    SQL to
    display them in whichever order you require.
    David Powers, Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • File Upload issues

    There is a file upload that I have and I am getting an
    error...
    Notice: Undefined variable: file_list in
    C:\vhosts\mysite\upload\index.php on line 20
    On line 20 in my php page happens to be the following code
    that is giving an error...$file_list .= "<option value=\"$file\"
    >$file</option>";
    <?php
    #for windows...
    $dirname = $_SERVER['DOCUMENT_ROOT'].'/_assets/professor/';
    //$dirname = "C:\\wamp\\www";
    #(for Linux... $dirname = "user/local/apache/bin";)
    $dir = opendir($dirname);
    while(false != ($file = readdir($dir))){
    if(($file != ".") and ($file != "..")){
    $file_list .= "<option value=\"$file\"
    >$file</option>";
    closedir($dir);
    ?>
    This is what is in the body...
    <form enctype="multipart/form-data" action="uploaded.php"
    method="POST">
    <fieldset><legend>Upload Professor
    Image</legend>
    <!-- MAX_FILE_SIZE must precede the file input field
    -->
    <!--input type="hidden" name="MAX_FILE_SIZE"
    value="30000" /-->
    <!-- Name of input element determines name in $_FILES
    array -->
    Send this file: <input name="userfile" type="file" />
    <div align="center"><input type="submit"
    value="Send File" /></div>
    </fieldset>
    </form>
    <br>
    <br>
    <form action="delete.php" method="post">
    <fieldset><legend>Delete Professor
    Image</legend>
    <select name="deleteFile">
    <?php echo($file_list); ?>
    </select>
    <div align="center"><input type="submit" name="go"
    value="Delete File"></div>
    </fieldset>

    AdonaiEchad wrote:
    > There is a file upload that I have and I am getting an
    error...
    > Notice: Undefined variable: file_list in
    C:\vhosts\mysite\upload\index.php on
    > line 20
    > On line 20 in my php page happens to be the following
    code that is giving an
    > error...$file_list .= "<option value=\"$file\"
    >$file</option>";
    What that's telling you is that you're adding a value to a
    variable that
    doesn't yet exist. In your case, it probably doesn't matter,
    but using
    undefined variables is a potential security risk. To
    eliminate the
    warning - and the risk - declare $file_list before using it:
    $file_list = '';
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • File upload glitch

    I am working with another tutorial (Lesson 9) in David Powers new book on adding attachments to an email sent from an online form. When I bring the form up in my browser, enter the information and attach the file, and submit, the form information and attachments do show up in my inbox fine. However, I get the following error messages in the browser:
    Warning:  file_get_contents(C:/upload_test/att1285896997-Mountains OMourne.docx) [function.file-get-contents]: failed to open stream: No such file or directory in C:\xampp\htdocs\WFRMA\scripts\process_attachments.php on line 53
    Warning:  unlink(C:/upload_test/att1285896997-Mountains OMourne.docx) [function.unlink]: No such file or directory in C:\xampp\htdocs\WFRMA\scripts\process_attachments.php on line 56
    Is there anyone who might know why I'm getting these messages even though the form submittal seems to otherwise be operating fine?

    Sorry to offend, I'm really quite new and obviously dumb as a post with the technology (even forums like this). I'll try to do better more quickly. The process_attachments script referred to in the error message looks like this:
    <?php
    require_once('library.php');
    $errors = array();
    try {
      $public_key = 'Your_public_key';
      $private_key = 'Your_private_key';
      $recaptcha = new Zend_Service_ReCaptcha($public_key, $private_key);
      if (isset($_POST['send'])) {
        // validate the user input
        if (empty($_POST['recaptcha_response_field'])) {
          $errors['recaptcha'] = 'reCAPTCHA field is required';
        } else {
          $result = $recaptcha->verify($_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field']);
          if (!$result->isValid()) {
            $errors['recaptcha'] = 'Try again';
        $val = new Zend_Validate_Alnum(TRUE);
        if (!$val->isValid($_POST['name'])) {
          $errors['name'] = 'Name is required';
        $val = new Zend_Validate_EmailAddress();
        if (!$val->isValid($_POST['email'])) {
          $errors['email'] = 'Email address is required';
        $val = new Zend_Validate_StringLength(10);
        if (!$val->isValid($_POST['comments'])) {
          $errors['comments'] = 'Required';
        require_once('get_attachments.php');
        if (!$errors) {
           // create and send the email
           require_once('mail_connector.php');
           $mail = new Zend_Mail('UTF-8');
           $mail->addTo('[email protected]', 'A N Other');
           $mail->setFrom('[email protected]', 'Zend Mail Test');
           $mail->setSubject('Comments from feedback form');
           $mail->setReplyTo($_POST['email'], $_POST['name']);
           $text = "Name: {$_POST['name']}\r\n\r\n";
           $text .= "Email: {$_POST['email']}\r\n\r\n";
           $text .= "Comments: {$_POST['comments']}";
           $html = '<html><head><title>';
           $html .= $mail->getSubject();
           $html .= '</title></head><body>';
           $html .= "<p><strong>Name: </strong><a href='mailto:{$_POST['email']}'>{$_POST['name']}</a></p>";
           $html .= '<p><strong>Comments: </strong>' . nl2br($_POST['comments']) . '</p>';
           $html .= '</body></html>';
           $mail->setBodyText($text, 'UTF-8');
           $mail->setBodyHtml($html, 'UTF-8');
           if (isset($_SESSION['attachments']) && !empty($_SESSION['attachments'])) {
              foreach($_SESSION['attachments'] as $attached) {
                $current_file = $destination . '/' . $_SESSION['att_id'] . $attached;
                $contents = file_get_contents($current_file);
                $att = $mail->createAttachment($contents);
                $att->filename = $attached;
                unlink($current_file);
              unset($_SESSION['attachments']);
              unset($_SESSION['att_id']);
           $success = $mail->send();
           if (!$success) {
             $errors = TRUE;
    } catch (Exception $e) {
      echo $e->getMessage();
    ?>
    I've intentionally left out the recaptcha keys in the code here.
    The get_attachments.php referred to in the above script looks like this:
    <?php
    session_start();
    $destination = 'C:/upload_test';
    $max_size = '50kB';
    $not_allowed = 'exe,vbs,shs,pif,lnk,dll';
    if (!isset($_SESSION['att_id'])) {
      $_SESSION['att_id'] = 'att' . time() .'-';
      $_SESSION['attachments'] = array();
      // set the destination for the upload
      $uploader = new Zend_File_Transfer_Adapter_Http();
      $uploader->setDestination($destination);
      // permit blank file fields
      $uploader->setOptions(array('ignoreNoFile' => TRUE));
      // set the validation criteria
      $uploader->addValidator('Size', FALSE, $max_size);
      $uploader->addValidator('ExcludeExtension', FALSE, $not_allowed);
      // get the details of the uploaded files
      $files = $uploader->getFileInfo();
      // loop through the files and deal with each file individually
      foreach($files as $file => $info) {
        // make sure a file has been uploaded
        if ($uploader->isUploaded($file)) {
          // get the file's name and replace spaces with underscores
          $filename = $uploader->getFileName($file, FALSE);
          if (!$uploader->isValid($file)) {
            $messages[] = "$filename exceeds $max_size or is not an acceptable type";
          } else {
            $attachment = $_SESSION['att_id'] . str_replace(' ', '_', $filename);
            $uploader->addFilter('Rename', array('target' => $attachment), $file);
            $success = $uploader->receive($file);
            // if the transfer failed, get the error messages
            if (!$success) {
              $messages[] = "$filename could not be attached";
            } else {
              // the transfer was OK, so tell the user what happened
              $messages[] = "$filename attached";
              $_SESSION['attachments'][] = $filename;

  • Stuck in Tutorial 2 of David Powers tutorials "Build dynamic sites and web applications".

    PLEASE NOTE - THIS IS ANEW SESSION! Apologies to those that have contributed already but I have been unable to reply unless by email on the original session!
    ========================================================================================== ==============================
    I am very new to Dreamweaver and indeed to mySql. So, I am going through the the 3 David Powers Tutorials that are available for PHP & MySQL. I have successfully negotiated the 1st tutorial and am on the 2nd one and have got to a place where I am stalled!I am working on the file "manage_posts.php" and have got successfully "Building a simple recordset" - successfully built the Recordset via that dialog box which tests perfectly showing the contents of the news Table in MySQL. I can bind the recordset results in the page and save the file "manage_posts.php" but when I click Live View the live view fails and I get a 404 error - in other words manage_posts.php does not show the last entry of the news table! I have tried everything that I can think of including deleting manage_posts.php and starting over, but still no good!
    Can anyone advise me on this please as to waht may be wrong and how perhaps to analyse what the error may be? I would appreciate any help as it is very frustrating not to be able to progress further.

    PLEASE NOTE - THIS IS ANEW SESSION! Apologies to those that have contributed already but I have been unable to reply unless by email on the original session!
    ========================================================================================== ==============================
    I am very new to Dreamweaver and indeed to mySql. So, I am going through the the 3 David Powers Tutorials that are available for PHP & MySQL. I have successfully negotiated the 1st tutorial and am on the 2nd one and have got to a place where I am stalled!I am working on the file "manage_posts.php" and have got successfully "Building a simple recordset" - successfully built the Recordset via that dialog box which tests perfectly showing the contents of the news Table in MySQL. I can bind the recordset results in the page and save the file "manage_posts.php" but when I click Live View the live view fails and I get a 404 error - in other words manage_posts.php does not show the last entry of the news table! I have tried everything that I can think of including deleting manage_posts.php and starting over, but still no good!
    Can anyone advise me on this please as to waht may be wrong and how perhaps to analyse what the error may be? I would appreciate any help as it is very frustrating not to be able to progress further.

  • Rename file extension during a file upload ??

    I need to rename the extension of a file at some point during the file upload. I am not sure where to do this at.
    The file needs to be renamed before it is written to the directory.
    Basically, the file will come in with a .txt or .doc type. Based on a users profile, I will change the type to a non-relavent number such as 1111.
    Here is my upload servlet. Can you tell me where to change the type so it will write the file with the new extension?
    Thanks.
    public class FileExport {
    //restrict upload files to 1 Meg
    private static final int DEFAULT_MAX_POST_SIZE = 1024 * 1024;
    private static final String NO_FILE = "unknown";
    private HttpServletRequest req;
    private File dir;
    private int maxSize;
    private Hashtable parameters = new Hashtable(); // name - Vector of values
    private Hashtable files = new Hashtable(); // name - UploadedFile
    public FileExport(HttpServletRequest request,
    String saveDirectory) throws IOException {
    this(request, saveDirectory, DEFAULT_MAX_POST_SIZE);
    // request the servlet request
    // saveDirectory = directory in which to save any uploaded files
    // maxPostSize = maximum size of the POST content
    public FileExport(HttpServletRequest request,
    String saveDirectory,
    int maxPostSize) throws IOException {
    // check values
    if (request == null)
    throw new IllegalArgumentException("request cannot be null");
    if (saveDirectory == null)
    throw new IllegalArgumentException("saveDirectory cannot be null");
    if (maxPostSize <= 0) {
    throw new IllegalArgumentException("maxPostSize must be positive");
    // Save the request, dir, and max size
    req = request;
    dir = new File(saveDirectory);
    maxSize = maxPostSize;
    // Check saveDirectory is truly a directory
    if (!dir.isDirectory())
    throw new IllegalArgumentException("Not a directory: " + saveDirectory);
    // Check saveDirectory is writable
    if (!dir.canWrite())
    throw new IllegalArgumentException("Not writable: " + saveDirectory);
    // Now parse the request saving data to "parameters" and "files";
    // write the file contents to the saveDirectory
    readRequest();
    public FileExport(ServletRequest request,
    String saveDirectory) throws IOException {
    this((HttpServletRequest)request, saveDirectory);
    public FileExport(ServletRequest request,
    String saveDirectory,
    int maxPostSize) throws IOException {
    this((HttpServletRequest)request, saveDirectory, maxPostSize);
    // Returns the names of all the parameters as an Enumeration of
    // Strings. It returns an empty Enumeration if there are no parameters.
    public Enumeration getParameterNames() {
    return parameters.keys();
    // Returns the names of all the uploaded files as an Enumeration of
    // Strings. It returns an empty Enumeration if there are no uploaded
    // files. Each file name is the name specified by the form, not by
    // the user.
    public Enumeration getFileNames() {
    return files.keys();
    // Returns the value of the named parameter as a String, or null if
    // the parameter was not sent or was sent without a value.
    public String getParameter(String name) {
    try {
    Vector values = (Vector)parameters.get(name);
    if (values == null || values.size() == 0) {
    return null;
    String value = (String)values.elementAt(values.size() - 1);
    return value;
    catch (Exception e) {
    return null;
    // Returns the values of the named parameter as a String array, or null if
    // the parameter was not sent.
    public String[] getParameterValues(String name) {
    try {
    Vector values = (Vector)parameters.get(name);
    if (values == null || values.size() == 0) {
    return null;
    String[] valuesArray = new String[values.size()];
    values.copyInto(valuesArray);
    return valuesArray;
    catch (Exception e) {
    return null;
    // Returns the filesystem name of the specified file, or null if the
    // file was not included in the upload. A filesystem name is the name
    // specified by the user. It is also the name under which the file is
    // actually saved.
    public String getFilesystemName(String name) {
    try {
    UploadedFile file = (UploadedFile)files.get(name);
    return file.getFilesystemName(); // may be null
    catch (Exception e) {
    return null;
    // Returns the content type of the specified file (as supplied by the
    //client browser), or null if the file was not included in the upload.
    public String getContentType(String name) {
    try {
    UploadedFile file = (UploadedFile)files.get(name);
    return file.getContentType(); // may be null
    catch (Exception e) {
    return null;
    // Returns a File object for the specified file saved on the server's
    // filesystem, or null if the file was not included in the upload.
    public File getFile(String name) {
    try {
    UploadedFile file = (UploadedFile)files.get(name);
    return file.getFile(); // may be null
    catch (Exception e) {
    return null;
    // method that actually parses the request.
    protected void readRequest() throws IOException {
    // Check the content length to prevent denial of service attacks
    int length = req.getContentLength();
    if (length > maxSize) {
    throw new IOException("Posted content length of " + length +
    " exceeds limit of " + maxSize);
    // Check the content type to make sure it's "multipart/form-data"
    // Access header two ways to work around WebSphere oddities
    String type = null;
    String type1 = req.getHeader("Content-Type");
    String type2 = req.getContentType();
    // If one value is null, choose the other value
    if (type1 == null && type2 != null) {
    type = type2;
    else if (type2 == null && type1 != null) {
    type = type1;
    // If neither value is null, choose the longer value
    else if (type1 != null && type2 != null) {
    type = (type1.length() > type2.length() ? type1 : type2);
    if (type == null ||
    !type.toLowerCase().startsWith("multipart/form-data")) {
    throw new IOException("Posted content type isn't multipart/form-data");
    // Get the boundary string; it's included in the content type.
    // Should look something like "------------------------12012133613061"
    String boundary = extractBoundary(type);
    if (boundary == null) {
    throw new IOException("Separation boundary was not specified");
    // Construct the special input stream we'll read from
    MultipartInputStreamHandler in =
    new MultipartInputStreamHandler(req.getInputStream(), length);
    // Read the first line, should be the first boundary
    String line = in.readLine();
    if (line == null) {
    throw new IOException("Corrupt form data: premature ending");
    // Verify that the line is the boundary
    if (!line.startsWith(boundary)) {
    throw new IOException("Corrupt form data: no leading boundary");
    // Now that we're just beyond the first boundary, loop over each part
    boolean done = false;
    while (!done) {
    done = readNextPart(in, boundary);
    // A utility method that reads an individual part. Dispatches to
    // readParameter() and readAndSaveFile() to do the actual work. A
    // subclass can override this method for a better optimized or
    // differently behaved implementation.
    protected boolean readNextPart(MultipartInputStreamHandler in,
    String boundary) throws IOException {
    // Read the first line, should look like this:
    // content-disposition: form-data; name="field1"; filename="file1.txt"
    String line = in.readLine();
    if (line == null) {
    // No parts left, we're done
    return true;
    else if (line.length() == 0) {
    // IE4 on Mac sends an empty line at the end; treat that as the end.
    // Thanks to Daniel Lemire and Henri Tourigny for this fix.
    return true;
    // Parse the content-disposition line
    String[] dispInfo = extractDispositionInfo(line);
    String disposition = dispInfo[0];
    String name = dispInfo[1];
    String filename = dispInfo[2];
    // Now onto the next line. This will either be empty
    // or contain a Content-Type and then an empty line.
    line = in.readLine();
    if (line == null) {
    // No parts left, we're done
    return true;
    // Get the content type, or null if none specified
    String contentType = extractContentType(line);
    if (contentType != null) {
    // Eat the empty line
    line = in.readLine();
    if (line == null || line.length() > 0) {  // line should be empty
    throw new
    IOException("Malformed line after content type: " + line);
    else {
    // Assume a default content type
    contentType = "application/octet-stream";
    // Now, finally, we read the content (end after reading the boundary)
    if (filename == null) {
    // This is a parameter, add it to the vector of values
    String value = readParameter(in, boundary);
    if (value.equals("")) {
    value = null; // treat empty strings like nulls
    Vector existingValues = (Vector)parameters.get(name);
    if (existingValues == null) {
    existingValues = new Vector();
    parameters.put(name, existingValues);
    existingValues.addElement(value);
    else {
    // This is a file
    readAndSaveFile(in, boundary, filename, contentType);
    if (filename.equals(NO_FILE)) {
    files.put(name, new UploadedFile(null, null, null));
    else {
    files.put(name,
    new UploadedFile(dir.toString(), filename, contentType));
    return false; // there's more to read
    // A utility method that reads a single part of the multipart request
    // that represents a parameter. A subclass can override this method
    // for a better optimized or differently behaved implementation.
    protected String readParameter(MultipartInputStreamHandler in,
    String boundary) throws IOException {
    StringBuffer sbuf = new StringBuffer();
    String line;
    while ((line = in.readLine()) != null) {
    if (line.startsWith(boundary)) break;
    sbuf.append(line + "\r\n"); // add the \r\n in case there are many lines
    if (sbuf.length() == 0) {
    return null; // nothing read
    sbuf.setLength(sbuf.length() - 2); // cut off the last line's \r\n
    return sbuf.toString(); // no URL decoding needed
    // A utility method that reads a single part of the multipart request
    // that represents a file, and saves the file to the given directory.
    // A subclass can override this method for a better optimized or
    // differently behaved implementation.
    protected void readAndSaveFile(MultipartInputStreamHandler in,
    String boundary,
    String filename,
    String contentType) throws IOException {
    OutputStream out = null;
    // A filename of NO_FILE means no file was sent, so just read to the
    // next boundary and ignore the empty contents
    if (filename.equals(NO_FILE)) {
    out = new ByteArrayOutputStream(); // write to nowhere
    // A MacBinary file goes through a decoder
    else if (contentType.equals("application/x-macbinary")){
    File f = new File(dir + File.separator + filename);
    out = new MacBinaryDecoderOutputStream(
    new BufferedOutputStream(
    new FileOutputStream(f), 8 * 1024));
    // A real file's contents are written to disk
    else {
    File f = new File(dir + File.separator + filename);
    out = new BufferedOutputStream(new FileOutputStream(f), 8 * 1024);
    byte[] bbuf = new byte[100 * 1024]; // 100K
    int result;
    String line;
    // ServletInputStream.readLine()
    // adds a \r\n to the end of the last line.
    // Since we want a byte-for-byte transfer, we have to cut those chars.
    boolean rnflag = false;
    while ((result = in.readLine(bbuf, 0, bbuf.length)) != -1) {
    // Check for boundary
    if (result > 2 && bbuf[0] == '-' && bbuf[1] == '-') { // quick pre-check
    line = new String(bbuf, 0, result, "ISO-8859-1");
    if (line.startsWith(boundary)) break;
    // Are we supposed to write \r\n for the last iteration?
    if (rnflag) {
    out.write('\r'); out.write('\n');
    rnflag = false;
    // Write the buffer, postpone any ending \r\n
    if (result >= 2 &&
    bbuf[result - 2] == '\r' &&
    bbuf[result - 1] == '\n') {
    out.write(bbuf, 0, result - 2); // skip the last 2 chars
    rnflag = true; // make a note to write them on the next iteration
    else {
    out.write(bbuf, 0, result);
    out.flush();
    out.close();
    // Extracts and returns the boundary token from a line.
    private String extractBoundary(String line) {
    // Use lastIndexOf() because IE 4.01 on Win98 has been known to send the
    // "boundary=" string multiple times. Thanks to David Wall for this fix.
    int index = line.lastIndexOf("boundary=");
    if (index == -1) {
    return null;
    String boundary = line.substring(index + 9); // 9 for "boundary="
    // The real boundary is always preceeded by an extra "--"
    boundary = "--" + boundary;
    return boundary;
    // Extracts and returns disposition info from a line, as a String array
    // with elements: disposition, name, filename. Throws an IOException
    // if the line is malformatted.
    private String[] extractDispositionInfo(String line) throws IOException {
    // Return the line's data as an array: disposition, name, filename
    String[] retval = new String[3];
    // Convert the line to a lowercase string without the ending \r\n
    // Keep the original line for error messages and for variable names.
    String origline = line;
    line = origline.toLowerCase();
    // Get the content disposition, should be "form-data"
    int start = line.indexOf("content-disposition: ");
    int end = line.indexOf(";");
    if (start == -1 || end == -1) {
    throw new IOException("Content disposition corrupt: " + origline);
    String disposition = line.substring(start + 21, end);
    if (!disposition.equals("form-data")) {
    throw new IOException("Invalid content disposition: " + disposition);
    // Get the field name
    start = line.indexOf("name=\"", end); // start at last semicolon
    end = line.indexOf("\"", start + 7); // skip name=\"
    if (start == -1 || end == -1) {
    throw new IOException("Content disposition corrupt: " + origline);
    String name = origline.substring(start + 6, end);
    // Get the filename, if given
    String filename = null;
    start = line.indexOf("filename=\"", end + 2); // start after name
    end = line.indexOf("\"", start + 10); // skip filename=\"
    if (start != -1 && end != -1) {                // note the !=
    filename = origline.substring(start + 10, end);
    // The filename may contain a full path. Cut to just the filename.
    int slash =
    Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\'));
    if (slash > -1) {
    filename = filename.substring(slash + 1); // past last slash
    if (filename.equals("")) filename = NO_FILE; // sanity check
    // Return a String array: disposition, name, filename
    retval[0] = disposition;
    retval[1] = name;
    retval[2] = filename;
    return retval;
    // Extracts and returns the content type from a line, or null if the
    // line was empty. Throws an IOException if the line is malformatted.
    private String extractContentType(String line) throws IOException {
    String contentType = null;
    // Convert the line to a lowercase string
    String origline = line;
    line = origline.toLowerCase();
    // Get the content type, if any
    if (line.startsWith("content-type")) {
    int start = line.indexOf(" ");
    if (start == -1) {
    throw new IOException("Content type corrupt: " + origline);
    contentType = line.substring(start + 1);
    else if (line.length() != 0) {  // no content type, so should be empty
    throw new IOException("Malformed line after disposition: " + origline);
    return contentType;
    // A class to hold information about an uploaded file.
    class UploadedFile {
    private String dir;
    private String filename;
    private String type;
    UploadedFile(String dir, String filename, String type) {
    this.dir = dir;
    this.filename = filename;
    this.type = type;
    public String getContentType() {
    return type;
    public String getFilesystemName() {
    return filename;
    public File getFile() {
    if (dir == null || filename == null) {
    return null;
    else {
    return new File(dir + File.separator + filename);
    // A class to aid in reading multipart/form-data from a ServletInputStream.
    // It keeps track of how many bytes have been read and detects when the
    // Content-Length limit has been reached.
    class MultipartInputStreamHandler {
    ServletInputStream in;
    int totalExpected;
    int totalRead = 0;
    byte[] buf = new byte[8 * 1024];
    public MultipartInputStreamHandler(ServletInputStream in,
    int totalExpected) {
    this.in = in;
    this.totalExpected = totalExpected;
    // Reads the next line of input. Returns null to indicate the end
    // of stream.
    public String readLine() throws IOException {
    StringBuffer sbuf = new StringBuffer();
    int result;
    String line;
    do {
    result = this.readLine(buf, 0, buf.length); // this.readLine() does +=
    if (result != -1) {
    sbuf.append(new String(buf, 0, result, "ISO-8859-1"));
    } while (result == buf.length); // loop only if the buffer was filled
    if (sbuf.length() == 0) {
    return null; // nothing read, must be at the end of stream
    sbuf.setLength(sbuf.length() - 2); // cut off the trailing \r\n
    return sbuf.toString();
    // A pass-through to ServletInputStream.readLine() that keeps track
    // of how many bytes have been read and stops reading when the
    // Content-Length limit has been reached.
    public int readLine(byte b[], int off, int len) throws IOException {
    if (totalRead >= totalExpected) {
    return -1;
    else {
    if (len > (totalExpected - totalRead)) {
    len = totalExpected - totalRead; // keep from reading off end
    int result = in.readLine(b, off, len);
    if (result > 0) {
    totalRead += result;
    return result;
    // Class to filters MacBinary files to normal files on the fly
    // Optimized for speed more than readability
    class MacBinaryDecoderOutputStream extends FilterOutputStream {
    int bytesFiltered = 0;
    int dataForkLength = 0;
    public MacBinaryDecoderOutputStream(OutputStream out) {
    super(out);
    public void write(int b) throws IOException {
    // Bytes 83 through 86 are a long representing the data fork length
    // Check <= 86 first to short circuit early in the common case
    if (bytesFiltered <= 86 && bytesFiltered >= 83) {
    int leftShift = (86 - bytesFiltered) * 8;
    dataForkLength = dataForkLength | (b & 0xff) << leftShift;
    // Bytes 128 up to (128 + dataForkLength - 1) are the data fork
    else if (bytesFiltered < (128 + dataForkLength) && bytesFiltered >= 128) {
    out.write(b);
    bytesFiltered++;
    public void write(byte b[]) throws IOException {
    write(b, 0, b.length);
    public void write(byte b[], int off, int len) throws IOException {
    // If the write is for content past the end of the data fork, ignore
    if (bytesFiltered >= (128 + dataForkLength)) {
    bytesFiltered += len;
    // If the write is entirely within the data fork, write it directly
    else if (bytesFiltered >= 128 &&
    (bytesFiltered + len) <= (128 + dataForkLength)) {
    out.write(b, off, len);
    bytesFiltered += len;
    // Otherwise, do the write a byte at a time to get the logic above
    else {
    for (int i = 0 ; i < len ; i++) {
    write(b[off + i]);

    I am also need to rename a file and extension while uploadinf the file to the server. The oreilly example seems only save as the same file name and ext. I wonder if you have the ability chANGE OIT OR NOT. pLEASE LET ME KNOW
    thanks
    kansen

  • Is this a CONCAT problem re: David Powers, or a Magic Quotes problem...

    I've tried to figure this out with the posts (and some info
    on David's site, etc), and I just can't seem to figure out the real
    problem.
    I'm working on a tutorial and I can't figure out if the error
    message is correct and it's improper coding inserted by DW (and if
    so, I can't figure out what to correct) or
    If this is a problem with DW8.0.2 along the lines of what the
    hotfix that seems to be so hard to get will fix, or
    If this is along the lines of an example of why magic quotes
    should be turned off, and if so, where/how do I turn them off, and
    will that correct the code, and if not, how would it be properly
    corrected?
    Here is the error message:
    Parse Error: parse error, unexpected '=', expecting ',' or
    ')' in <thefile> on line 34.
    Here is the code it is referencing:
    32 $Search_rsSearch = "abc";
    33 if (isset(#txtSearch#)) {
    34 $Search_rsSearch = (get_magic_quotes_gpc()) ? #txtSearch#
    : addslashes(#txtSearch#);
    35 }
    36 mysql_select_db($database_dorknozzle, $dorknozzle);
    37 $query_rsSearch = sprintf("SELECT * FROM EmployeeStore
    WHERE ItemName LIKE CONCAT('%%', %s,
    '%%')", GetSQLValueString($Search_rsSearch, "text"));
    38 $rsSearch = mysql_query($query_rsSearch, $dorknozzle) or
    die(mysql_error());
    39 $row_rsSearch = mysql_fetch_assoc($rsSearch);
    40 $totalRows_rsSearch = mysql_num_rows($rsSearch);
    I'm using php4.4.4, mysql5.0.24, apache2.2.3
    Thank You,
    Jeff G.

    xViPERed wrote:
    > If this is a problem with DW8.0.2 along the lines of
    what the hotfix that
    > seems to be so hard to get will fix,
    That will fix part of your problem, but the error is caused
    by something
    else:
    > Here is the error message:
    >
    Parse Error: parse error, unexpected '=', expecting ',' or
    ')' in
    > <thefile> on line 34.
    >
    > Here is the code it is referencing:
    > 32 $Search_rsSearch = "abc";
    > 33 if (isset(#txtSearch#)) {
    > 34 $Search_rsSearch = (get_magic_quotes_gpc()) ?
    #txtSearch# :
    > addslashes(#txtSearch#);
    > 35 }
    # is one of the PHP characters used to comment out part of a
    script. I
    suspect that you have got this from the Dreamweaver help
    files, which
    are particularly unhelpful on this point. The show the
    runtime value
    expression as #formFieldName#, which is ColdFusion style, not
    PHP. You
    need to replace #txtSearch# with something like
    $_GET['search'] or
    $_POST['search'].
    What makes things worse is that the code inserted by 8.0.2
    without the
    hotfix is also incorrect. Line 34 should be something like
    this:
    $Search_rsSearch = $_GET['search'];
    Line 37 is also wrong.
    > 37 $query_rsSearch = sprintf("SELECT * FROM
    EmployeeStore WHERE ItemName LIKE
    > CONCAT('%%', %s,
    > '%%')", GetSQLValueString($Search_rsSearch, "text"));
    It should be this:
    $query_rsSearch = sprintf("SELECT * FROM EmployeeStore WHERE
    ItemName
    LIKE %s", GetSQLValueString("%" . $Search_rsSearch . "%",
    "text"));
    David Powers
    Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    http://foundationphp.com/

  • "Adobe Dreamweaver PHP Training from David Powers

    “Adobe® Dreamweaver® CS5 with PHP Training from the Source  David Powers
    Lesson 7 Validating Input on the Server
    I have reached page 445, and become completely stuck - I've been about three weeks trying to sort the problem but cant get anywhere.  Not sure what to do from here so any advice would be really appreciated.  The problem:
    I have completed the script exactly as instructed, when I go live (local sever), I get a blank screen, OK, does not display.  I am sure this is something simple but I have done all the fault finding and am out foxed.  I know the local server works OK - I completed chapter 6 successfully - I can also run a php test page from the local folder that the file is stored in. i.e provictis/phpcs5.  I have saved my ZendFraework in a separate location as advised. i.e. User/SPENNY/...    
    This is the basic code:
    <?php
    $library='/Users/SPENNY/ZendFramework/library';
    set_include_path(get_include_path() . PATH_SEPARATOR .
    $library);
    require_once('Zend/Loader/Autoloader.php');
    $loader=Zend_Loader_Autoloader::getInstance();
    if ($loader) {
              echo 'ok';
    } else {
              echo 'Huston we have a blinkin problem, but do not panic we will get things sorted';
    Gareth

    FIXED!!
    1)
    i finally did get the message problem was with:
    $mailhost='ssl://mail.domain.com';
    ssl:// was just nonsense and been removed
    2)
    'auth' => 'true' was changed to 'auth' => 'login'
    3)
    for bluehost i got information that it was tls secure connection protocol not ssl
    'ssl' => 'tls'
    4)
    port used '25' not 465.
    Didnt still tried 26 and 465 maybe they would work too.

  • For  David Powers ?

    David,
    Hope you having a good break from here - as you've not been
    around for
    a few days.
    When you are back - I need a little help please
    ~Malcolm N....
    ~

    > Come to think about it - Murray seemed to make the move
    to using php
    > only a few months ago - and given his enthusiasm for
    SSI's maybe this
    > tells something about the next release - or maybe I'm
    reading too much
    > between the lines (:-))
    You're looking for deep inner meaning in a shallow bowl, I'm
    afraid! 8)
    Templates are part of DW and will be for a long time. And
    personally, I
    have no problem with includes in DW templates.....
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Malcolm N_" <[email protected]> wrote in message
    news:[email protected]...
    > On Sat, 27 Jan 2007 19:38:04 +0000, David Powers
    <[email protected]>
    > wrote:
    >>
    >>I'll wait for the summary. The basic thing to
    remember about include()
    >>is that it expects a relative path, an absolute path,
    or for the file to
    >>be in the PHP include path.
    >
    > Thanks David - at the moment things are under control,
    but I haven't
    > altered much of the site with DW.
    >
    >> Things get complicated if you use includes
    >>with Dreamweaver templates.
    >
    > Yes - well DW has been good at controlling some tricky
    things to date,
    > I hope that the next release makes using includes within
    simple
    > Template's a little easier.
    >
    > After all the Adobe Community Experts have been pushing
    the use of
    > SSI's very strongly in the last couple of years, telling
    us to abandon
    > tables, and complex templates (:-))
    >
    > Come to think about it - Murray seemed to make the move
    to using php
    > only a few months ago - and given his enthusiasm for
    SSI's maybe this
    > tells something about the next release - or maybe I'm
    reading too much
    > between the lines (:-))
    >
    > --
    >
    > ~Malcolm N....
    > ~

  • FTAO - David Powers

    David (php guru that you are
    , this is directed to you as I have no
    concept of this wee problem I have.
    I signed up with a new unix host, so that I could set up a
    link directory
    script for testing purposes. According to the help doc, once
    I typed in the
    path to the install script, this "you bewt" script was
    supposed to install
    itself and away I'd go. I had the following from the host
    after I asked why
    I was getting an 'internal error' trying to run the scrip:
    "the reason you are getting the internal server error is
    because we do not
    allow mod rewrites in the htaccess file. If you need to use
    these we can
    add them to your hosting container on the server. Please let
    us know."
    What does this mean exactly and would adding them for my use
    cause problems
    for my site or any other user on the server?
    Nadia
    Adobe� Community Expert : Dreamweaver
    http://www.csstemplates.com.au
    - CSS Templates | Free Templates
    http://www.DreamweaverResources.com
    - Dropdown Menu Templates|Tutorials
    http://www.macromedia.com/devnet/dreamweaver/css.html
    - CSS Tutorials

    Thanks David,
    I asked the new host (who were suprisingly quick to respond
    to my initial
    support ticket - considering the time differences) to add the
    mod, which
    they did within minutes of my request. Now however, I'm
    getting a
    "forbidden' error.
    So off to email them again ;-)
    PS: I even get a standard install of Wordpress with the host,
    so will
    definitely have to get to your book one day soon !
    Nadia
    Adobe� Community Expert : Dreamweaver
    http://www.csstemplates.com.au
    - CSS Templates | Free Templates
    http://www.DreamweaverResources.com
    - Dropdown Menu Templates|Tutorials
    http://www.macromedia.com/devnet/dreamweaver/css.html
    - CSS Tutorials
    "David Powers" <[email protected]> wrote in message
    news:[email protected]...
    > .: Nadia :. *ACE* wrote:
    >> David (php guru that you are
    , this is directed to you as I have no
    >> concept of this wee problem I have.
    >
    > That's very nice of you, Nadia, but mod_rewrite has
    nothing to do with
    > PHP; it's an Apache module.
    >
    >> "the reason you are getting the internal server
    error is because we do
    >> not allow mod rewrites in the htaccess file. If you
    need to use these we
    >> can add them to your hosting container on the
    server. Please let us
    >> know."
    >>
    >> What does this mean exactly and would adding them
    for my use cause
    >> problems for my site or any other user on the
    server?
    >
    > It means you can't add a mod_rewrite command through
    .htaccess, but the
    > server administrator is willing to do it for you. If
    it's set up
    > correctly, it should have no impact on your current site
    or anyone else's.
    >
    > Disclaimer: my knowledge of Apache is basically limited
    to simple things,
    > such as installing PHP, creating virtual hosts, and a
    little maintenance.
    > I leave things like mod_rewrite to the experts.
    WordPress uses mod_rewrite
    > to provide nice looking links to blog entries. I use it
    on my site, but
    > all the mod_rewrite stuff is handled by WordPress. I
    haven't touched it
    > myself.
    >
    > --
    > David Powers
    > Author, "Foundation PHP for Dreamweaver 8" (friends of
    ED)
    > Author, "Foundation PHP 5 for Flash" (friends of ED)
    >
    http://foundationphp.com/

  • Same old same old: calling David Powers

    It has been interesting to watch and read the comments recently about the DW tangle with database-driven sites.
    I am using DW CS6 (12.03) Mac with Mountain Lion, and have MAMP installed and runnning.
    I have religiously finished David Powers tute at here.
    Question:
    Why am I getting the "Dynamically related files could not be resolved because of an internal error" when I render the page with the Live button?
    The page displays blank . . . LOL
    Can anyone point me to the possible cause?
    I wonder why Adobe has left this up for 3 years when (after all updates) the message still appears and development stops.
    Are the tutorial files faulty, or have I missed soemthing?
    David: can you shed light on this please?

    Nancy and David
    Thanks for reply and here are your suggestions:
    Below that 3 screen shots (2 from DW and 1 from phpMyAdmin FYI.
    I have rebuilt this several times (incl DW Site, database and DW Connection) but I am still running into the same error msg as originally when "Live" is attempted in DW.
    Code from Comment.php
    start---------------------------------------------------------
    <?php require_once('Connections/connTest.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    mysql_select_db($database_connTest, $connTest);
    $query_getComments = "SELECT first_name, last_name, `comment` FROM comments ORDER BY comment_id DESC";
    $getComments = mysql_query($query_getComments, $connTest) or die(mysql_error());
    $row_getComments = mysql_fetch_assoc($getComments);
    $totalRows_getComments = mysql_num_rows($getComments);
    ?>
    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Cafe Townsend - Customer Comments</title>
    <link href="assets/styles.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div id="wrapper">
      <div id="header"><img src="assets/header.jpg" width="700" height="92" alt="Cafe Townsend" /></div>
      <h1 id="main_header">Cafe Townsend Intranet</h1>
      <div id="main">
        <h2>Customer comments</h2>
        <div id="comments">
          <?php do { ?>
            <p><?php echo $row_getComments['comment']; ?> &#8212; <?php echo $row_getComments['first_name']; ?> <?php echo $row_getComments['last_name']; ?></p>
            <?php } while ($row_getComments = mysql_fetch_assoc($getComments)); ?>
        </div>
      </div>
      <div id="footer"></div>
    </div>
    </body>
    </html>
    <?php
    mysql_free_result($getComments);
    ?>
    end -------------------------------------------
    Looking forward to your thoughts on this. Tony
    Thanks again!

  • Issue for ch03 in Dreameaver CS5.5 Studio Techniques by David Powers

    Hello David,
    I am following your book.
    I read you was in Japan in 1994. Me too. :-). From 1994-1997. In Kyoto.
    My question is about the file index.html.
    When I removed most of the text, and have for intance:
    div id="wrapper">
      <div id="header" role="banner">
        <h1>Tozai Hotel</h1>
      </div>
      <ul id="nav" role="navigation">
        <li><a href="index.html">Home</a></li>
        <li><a href="rooms.html">Guest Rooms</a></li>
        <li><a href="dining.html">Dining</a></li>
        <li><a href="garden.html">Garden</a></li>
        <li><a href="reservations.html">Reservations</a></li>
      </ul>
      <div id="hero" role="main">
        <h2>Where East Meets West</h2>
        <p><i lang="ja">Tozai</i> is Japanese for &#8220;East-West.&#8221; It epitomizes the welcome we offer our guests, combining western-style luxury with <a href="dining.html">the best in Japanese cuisine</a> and hospitality.</p>
    <!-- text removed -->
      </div>
    </div>
    I have a strange begavior.
    Using an iTouch, my page is floating. And when I try to use Landscape and then return to Portrait, the page seemed to be zoomed.
    Sorry for my english.
    If you have an idea, it is welcomed.
    Jilusan

    I think you mean our Community Professional, David Powers. If you want to specifically contact him, you should send him a Private Message with a link to this thread here: http://forums.adobe.com/people/David_Powers
    Coming to answer your question, post your CSS file here. The styling is managed by the CSS, not by the HTML. Only with your CSS we can help you.

  • David Powers cs5 with php...Zend

    This one is aimed for David Powers. We are using your book for my advanved programming class. I continually have problems because they had us buy a domain instead of the one the book does it. At this point I'm on page 222ish, installing Zend. Obviously I'm using dreamweaver and my domain is with godaddy.com. I'm doing the section where you are are installing the library. I've got the library.php with no errors, I'm connected to my domain, and I have the zend file inside my local site folder. I've tried in the C drive but I cotinually get the same error:
    Warning: require_once(Zend/Loader/Autoloader.php) [function.require-once]: failed to open stream: No such file or directory in/home/content/79/7340479/html/library.php on line 4
    Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader/Autoloader.php' (include_path='.:/usr/local/php5/lib/php:C:\Users\Becky\Desktop\colts\ZF\ZendFramework-1. 11.4-minimal\library') in /home/content/79/7340479/html/library.php on line 4
    I've tried putting the zend folder in c, desktop, in side local site folder and same thing everytime. Any help would be appreciated.

    Re: David Powers cs5 with php...Zend
    Ok I'm gonna try and help ya until David gets here. Since I use Zend and have read parts of his book.
    First, are you trying to install zend at godaddy?
    Your include file is odd. "include_path='.:/usr/local/php5/lib/php:C:\Users\Becky\Desktop\colts \ZF\ZendFramework-1.11.4-minimal\library') in/home/content/79/7340479/html/library.php" - means PHP and Zend are located on 2 different machines
    I appreciate it. the "C:\Users\Becky\Desktop\colts \ZF\ZendFramework-1.11.4-minimal\library' is where the file path.I use Godaddy but I have it zend on my computer and am just trying to get it to run. I tried running it from desktop, C:(where it's at), andneven put it in the file manager on godaddy and tried that path...
    the code I'm using is:
    <?php
    $library = 'C:\Users\Becky\Desktop\colts\ZF\ZendFramework-1.11.4-minimal\library';
    set_include_path(get_include_path() . PATH_SEPARATOR . $library);
    require_once('Zend/Loader/Autoloader.php');
    $loader = Zend_Loader_Autoloader::getInstance();
    if ($loader) {
    echo 'OK';
    } else {
    echo 'We have a problem';
    I'm followed the book step by step but...
    when i click autoloader.php in the tab bar it has a get option. but when i click it it says "operation failed because it is not on the remote site.

  • David Powers snippets egdwcs3_snippets.mxp?

    I am working through David Powers book "Dreamweaver CS3 with CSS, AJAX, and PHP" Chapter 11 requires the file egdwcs3_snippets.mxp. This is a snippet used with Dreamweaver CS3.
    Can anyone send it to my email address or advise where I can download it?
    My email is [email protected]
    Many thanks!
    Carver

    http://www.friendsofed.com/download.html?isbn=1590598598<br /><br />"Carver Washburn" <[email protected]> wrote in message <br />news:[email protected]..<br />>I am working through David Powers book "Dreamweaver CS3 with CSS, AJAX, and <br />>PHP" Chapter 11 requires the file egdwcs3_snippets.mxp. This is a snippet <br />>used with Dreamweaver CS3.<br />><br />> Can anyone send it to my email address or advise where I can download it?<br />> My email is [email protected]<br />><br />> Many thanks!<br />><br />> Carver

  • Creating category lists with php (David Powers???)

    I am creating a dynamic content website with numerous entries under various categories. The categories are kept in a seperate mysql that looks something like this (an example):
    ID
    Main
    Sub
    1
    food
    candy
    2
    food
    meat
    3
    drink
    coke
    4
    drink
    snapple
    5
    drink
    dr. pepper
    6
    food
    bread
    I have created a page where the user can see all of the main categories. In the above case, food and drink. I do not want 'food' and 'drink' to be repeated three times. So I have used php code which david powers gives in his recipe: http://cookbooks.adobe.com/post_Create_nested_lists_from_a_recordset__PHP_-16720.html.
    The problem is that in the above case, the page will list: food, drink, food. This is because when the php passes through the 'drink's it then sees the last 'food' as being unique.
    How do I get rid of this issue (without having to to continuosly reorder my mysql table)?
    thanks
    P.S. I am posting this here and not on the above recipe page because I am hoping for a quicker response.

    Re: David Powers cs5 with php...Zend
    Ok I'm gonna try and help ya until David gets here. Since I use Zend and have read parts of his book.
    First, are you trying to install zend at godaddy?
    Your include file is odd. "include_path='.:/usr/local/php5/lib/php:C:\Users\Becky\Desktop\colts \ZF\ZendFramework-1.11.4-minimal\library') in/home/content/79/7340479/html/library.php" - means PHP and Zend are located on 2 different machines
    I appreciate it. the "C:\Users\Becky\Desktop\colts \ZF\ZendFramework-1.11.4-minimal\library' is where the file path.I use Godaddy but I have it zend on my computer and am just trying to get it to run. I tried running it from desktop, C:(where it's at), andneven put it in the file manager on godaddy and tried that path...
    the code I'm using is:
    <?php
    $library = 'C:\Users\Becky\Desktop\colts\ZF\ZendFramework-1.11.4-minimal\library';
    set_include_path(get_include_path() . PATH_SEPARATOR . $library);
    require_once('Zend/Loader/Autoloader.php');
    $loader = Zend_Loader_Autoloader::getInstance();
    if ($loader) {
    echo 'OK';
    } else {
    echo 'We have a problem';
    I'm followed the book step by step but...
    when i click autoloader.php in the tab bar it has a get option. but when i click it it says "operation failed because it is not on the remote site.

Maybe you are looking for