PHP script for form to upload 2 files to FTP

Ask a Question related to Macromedia Dynamic HTML, Design and Development.

  1. #1

    Default PHP script for form to upload 2 files to FTP

    Hi,

    I have scoured the internet for quite a while now looking for a free php
    script that will enable me to:

    1. Put a form on a page that has two uplaod boxes for a client to upload two
    file svia theeir browser
    2.The files will be one image (jpg) and one pdf
    3. The files will always (each day) be called headshot.jpg and resume.pdf
    4. The script must allow the files on the server to be overwritten by the new
    files of the same name each day

    I have found MANY scripts, som eof which i can get to work, but they were too
    sofisticated (checked for many things taht i was not concerned for, didnt allow
    files to be overwritten, changed directories of where the files were uplaoded
    to, changed the file names automatically) and many that i wasnt able to get to
    work.

    I just need something simple like the above. Unfortunately I am no scripter,
    so when i tried to decifer the ready made scripts and rearrange them to suit my
    needs, i messed things up.

    Thanks immensely in advance of anyone who canb offer m eany help or point me
    in a better direction. I wasnt sure where to post this query/help plea.

    Cheska



    ccesca Guest

  2. Similar Questions and Discussions

    1. PHP - upload files thru form - security question
      I finally succeeded in uploading files to a server thru a PHP-form. Last obstacle was permission denied to copy the file from tmp directory to the...
    2. file upload form enctype="multipart/form-data
      I'm upload a file using cffile upload and that seems to work fine except I need to use enctype="multipart/form-data on the form side. This isn't a...
    3. Upload Multiple Files in one form
      I am trying to upload the track information for cd's, and also upload the audio sample files at the same time. The samples are real media at this...
    4. form upload images using php form script
      Hi, I normally use CGI to process my html forms. However, this time I need/want to use PHP. Can anyone point me in the direction of a php...
    5. Upload files to site, upload info to SQL?
      I want to create a _SECURE_ interface from an html form that allows certain people within my company to upload files into a predetermined directory...
  3. #2

    Default Re: PHP script for form to upload 2 files to FTP

    Go to [url]http://www.php.net[/url] and read about file uploads there. You will find
    several scripts that will work just fine for you.

    Or try this -

    <?php
    //places files into same dir as form resides
    if(isset($_POST['Submit'])) {
    $target=$_SERVER['DOCUMENT_ROOT']."/uploads";
    foreach ($_FILES["files"]["error"] as $key => $error) {
    if ($error == UPLOAD_ERR_OK) {
    $tmp_name = $_FILES["files"]["tmp_name"][$key];
    $name = $_FILES["files"]["name"][$key];
    if(move_uploaded_file($tmp_name, "$target/$name")}
    print "Upload completed";
    else
    print "Upload failed";
    }
    }
    }
    ?>

    <body>
    <form action="" method="post" enctype="multipart/form-data">
    <p>Pictures:
    <input type="file" name="files[]" />
    <input type="file" name="files[]" />
    <input type="submit" name="Submit" value="Send" />
    </p>
    </form>

    This assumes that the incoming files will be properly named, and that the
    upload destination is a folder called "/uploads".


    --
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    [url]http://www.dreamweavermx-templates.com[/url] - Template Triage!
    [url]http://www.projectseven.com/go[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.dwfaq.com[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.macromedia.com/support/search/[/url] - Macromedia (MM) Technotes
    ==================


    "ccesca" <webforumsuser@macromedia.com> wrote in message
    news:e742fb$4s6$1@forums.macromedia.com...
    > Hi,
    >
    > I have scoured the internet for quite a while now looking for a free php
    > script that will enable me to:
    >
    > 1. Put a form on a page that has two uplaod boxes for a client to upload
    > two
    > file svia theeir browser
    > 2.The files will be one image (jpg) and one pdf
    > 3. The files will always (each day) be called headshot.jpg and resume.pdf
    > 4. The script must allow the files on the server to be overwritten by the
    > new
    > files of the same name each day
    >
    > I have found MANY scripts, som eof which i can get to work, but they were
    > too
    > sofisticated (checked for many things taht i was not concerned for, didnt
    > allow
    > files to be overwritten, changed directories of where the files were
    > uplaoded
    > to, changed the file names automatically) and many that i wasnt able to
    > get to
    > work.
    >
    > I just need something simple like the above. Unfortunately I am no
    > scripter,
    > so when i tried to decifer the ready made scripts and rearrange them to
    > suit my
    > needs, i messed things up.
    >
    > Thanks immensely in advance of anyone who canb offer m eany help or point
    > me
    > in a better direction. I wasnt sure where to post this query/help plea.
    >
    > Cheska
    >
    >
    >

    Murray *ACE* Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139