www.webdeveloper.com
Results 1 to 5 of 5

Thread: file uploading with PHP

  1. #1
    Join Date
    Oct 2007
    Posts
    4

    file uploading with PHP

    I have looked at a lot of examples of this and have adopted the same approach and it works I can get a file uploaded to the server. I have checked that it uploads all the time. However the HTML application that contains this code...
    <form name='form' action="inc/uploadPlotData01.php" enctype="multipart/form-data" method="POST" >
    <label class='label'>Enter/Select File for Uploading:</label><br />
    <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
    <input id="file" class='box' type="file" name="file" value="" size="40" title='locate the file for uploading and plotting on map'/>
    <input class='butt' type="submit" value="Upload" />
    </form>

    ... transfers the control to the PHP application (uploadPlotData01.php) into another window instance and never returns. The user can of course use the 'back' button but that's simply not on.

    The server-side PHP code is as follows:
    <?php
    $uploaddir = 'uploads/';
    $uploadfile = $uploaddir . basename($_FILES['file']['name']);
    move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile);
    ?>

    This can be tested at...

    http://demo.cubewerx.com.au/NuMaps/test.html

    There must be something I am missing here. Does anyone have a clue?

    Cheers...

  2. #2
    Join Date
    Jun 2003
    Location
    here
    Posts
    4,551
    PHP Code:
    header("location: http://demo.cubewerx.com.au/NuMaps/test.html"); 

  3. #3
    Join Date
    Oct 2007
    Posts
    4

    File Upload with PHP

    Thanks this has helped me. However, this re submits the page again and loses all previous status. I want to keep everything the same, upload the file and then allow the user to do something as part of a sequential process.

    Cheers,

  4. #4
    Join Date
    Oct 2007
    Posts
    4

    File Upload with PHP

    Thanks this has helped me. However, this re-submits the original HTML app again and loses all previous status. I want to keep everything the same, upload the file and then allow the user to do something as part of a sequential process.

    Cheers,

  5. #5
    Join Date
    Jun 2003
    Location
    here
    Posts
    4,551
    you could try puting the form in an Iframe, or include the PHP code directly into your form page, this is about the only systems I can think of that will work.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles