Web Analytics Made Easy -
StatCounter uploading file help - CodingForum

Announcement

Collapse
No announcement yet.

uploading file help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • uploading file help

    I have a small test file that I'm trying to upload a file to my server but it doesn't work and I don't know why.

    I have a file called Test.php which contains the upload file info and it calls TestDispatcher.php to do the actual upload.

    Here is Test.php
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <
    HTML>
    <
    HEAD>
    <
    TITLE>Test</TITLE>
    </
    HEAD>
    <
    BODY>
    <
    FORM NAME="search_form" ACTION="TestDispatcher.php" METHOD="post" ENCTYPE="multipart/form-data">
    <
    INPUT TYPE="file" NAME="frm_filename_to_upload_textbox" SIZE="65">
    <
    INPUT NAME="btn_ftp_upload_new_file" TYPE="submit" VALUE="Upload File">
    </
    FORM>
    </
    HTML

    Here is TestDispatcher.php
    PHP Code:
    <?php
    $php_File 
    $_FILES['frm_filename_to_upload_textbox']['name'];

    if (
    move_uploaded_file($frm_filename_to_upload_textbox,"/public_html/uploads/".$php_File))
       {
         print 
    "ok";
       }
    else
       {
         print 
    "fail";
       }
    ?>

    Here is the warnings I get:

    Warning: move_uploaded_file(/public_html/rfresh/Test1.xls) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/ftpweb/public_html/TestDispatcher.php on line 4

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpZm84Dc' to '/public_html/rfresh/Test1.xls' in /home/ftpweb/public_html/TestDispatcher.php on line 4
    fail


    Uploads directory is 777.

    Thanks for any help
    RalphF
    Business Text Messaging Services
    https://www.MobileTextingService.com

  • #2
    This line ...

    "/public_html/uploads/".$php_File))

    is a relative path reference.

    If your script already resides within "public_html", you
    don't need to specify that.

    So try this instead ...

    "uploads/".$php_File))

    Comment


    • #3
      That was it...thanks...
      RalphF
      Business Text Messaging Services
      https://www.MobileTextingService.com

      Comment

      Working...
      X