Uploading a file

Discussion in 'HTML' started by Matt Fulford, Dec 15, 2003.

  1. Matt Fulford

    Matt Fulford Guest

    Does anybody know any methods of allowing a user of your website to upload a
    file they choose from their hard drive? For example, somebody looking at a
    jobs website should have the option to press a button "Upload CV" and be
    presented with a File Open dialog box in order to select the appropriate
    file to upload.

    Thanks
     
    Matt Fulford, Dec 15, 2003
    #1
    1. Advertising

  2. Matt Fulford

    brucie Guest

    in post <news:>
    Matt Fulford said:

    > Does anybody know any methods of allowing a user of your website to upload a
    > file they choose from their hard drive?


    File input (or "upload") in HTML forms
    http://www.cs.tut.fi/~jkorpela/forms/file.html

    --
    brucie
    15/December/2003 09:35:38 pm kilo
     
    brucie, Dec 15, 2003
    #2
    1. Advertising

  3. Matt Fulford

    PW Guest

    PW, Dec 15, 2003
    #3
  4. Matt Fulford

    Dylan Parry Guest

    PW wrote:

    >
    > Take the easy way out, like I did.
    >
    > Buy ASPUpload.


    and you *know* he is using an IIS/ASP enabled server because?

    --
    Dylan Parry
    http://www.webpageworkshop.co.uk - FREE Web tutorials and references
    Now playing: Yes - Real Love from "Talk"
     
    Dylan Parry, Dec 15, 2003
    #4
  5. PW wrote:
    > Take the easy way out, like I did.
    >
    > Buy ASPUpload.
    >
    > http://www.persits.com


    Anyone who would pay $150 for an upload script is either insane, rich,
    or using their boss's money.
     
    Leif K-Brooks, Dec 15, 2003
    #5
  6. Matt Fulford

    brucie Guest

    in post <news:p>
    Dylan Parry said:

    >> Buy ASPUpload.


    > and you *know* he is using an IIS/ASP enabled server because?


    its just a very bad guess. usage has been in decline for the last 3
    years (just a little peak in sep 2001). only about 21% still use it.

    --
    brucie
    15/December/2003 10:18:51 pm kilo
     
    brucie, Dec 15, 2003
    #6
  7. Leif K-Brooks wrote:

    > Anyone who would pay $150 for an upload script is either insane, rich,
    > or using their boss's money.


    Very true. My PHP upload script on the intranet at work is 35 lines long
    (and that does a decent amount of error checking). $150 for $35 lines of
    code?

    <?php
    header("Content-Type: text/html");

    function accept_upload ($d) {
    $s = $_FILES['myfile']['tmp_name'];
    move_uploaded_file($s,$d);
    }

    $dest = '/mnt/common' . $_POST['destination'];
    if (is_dir($dest)) {
    if (strlen($dest) < 14) {
    $error = "Please put it in a folder -- not just in 'G:'";
    } else {
    if (strlen($_FILES['myfile']['name']) > 0) {
    $dest .= $_FILES['myfile']['name'];
    while (file_exists($dest)) {
    $dest = "New upload of $dest";
    }
    accept_upload($dest);
    } else {
    $error = "It would help if you told me which file.";
    }
    }
    } else {
    $error = "Destination folder doesn't seem to exist!";
    }

    if ($error) {
    ?>
    <title>Error</title>
    <h1>Error</h1>
    <p><?php echo $error; ?></p>
    <?php
    } else {
    header('Location: /g/' . $_POST['destination']);
    }
    ?>


    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
     
    Toby A Inkster, Dec 15, 2003
    #7
  8. Matt Fulford

    Wipkip Guest

    While sitting in a puddle Toby A Inkster scribbled in the mud:

    > Leif K-Brooks wrote:
    >
    >> Anyone who would pay $150 for an upload script is either insane,
    >> rich, or using their boss's money.

    >
    > Very true. My PHP upload script on the intranet at work is 35 lines
    > long (and that does a decent amount of error checking). $150 for $35
    > lines of code?
    >
    > <?php
    > header("Content-Type: text/html");
    >
    > function accept_upload ($d) {
    > $s = $_FILES['myfile']['tmp_name'];
    > move_uploaded_file($s,$d);
    > }
    >
    > $dest = '/mnt/common' . $_POST['destination'];
    > if (is_dir($dest)) {
    > if (strlen($dest) < 14) {
    > $error = "Please put it in a folder -- not
    > just in 'G:'";
    > } else {
    > if (strlen($_FILES['myfile']['name']) > 0) {
    > $dest .= $_FILES['myfile']['name'];
    > while (file_exists($dest)) {
    > $dest = "New upload of $dest";
    > }
    > accept_upload($dest);
    > } else {
    > $error = "It would help if you told me
    > which file.";
    > }
    > }
    > } else {
    > $error = "Destination folder doesn't seem to exist!";
    > }
    >
    > if ($error) {
    > ?>
    > <title>Error</title>
    > <h1>Error</h1>
    > <p><?php echo $error; ?></p>
    > <?php
    > } else {
    > header('Location: /g/' . $_POST['destination']);
    > }
    > ?>
    >
    >


    So is this script $150.00 or #35.00 a line. Kind of a big difference
    there. ;)

    --
    Duende
    Today I will engage my dynamic perfection
     
    Wipkip, Dec 15, 2003
    #8
  9. Toby A Inkster wrote:
    > Leif K-Brooks wrote:
    >
    >> Anyone who would pay $150 for an upload script is either insane,
    >> rich, or using their boss's money.

    >
    > Very true. My PHP upload script on the intranet at work is 35 lines
    > long (and that does a decent amount of error checking). $150 for $35
    > lines of code?
    >


    At 12 lines per day that works out at $50 per day. Good value I reckon ;o)

    --
    William Tasso - http://WilliamTasso.com
     
    William Tasso, Dec 15, 2003
    #9
  10. Matt Fulford

    brucie Guest

    in post <news:p>
    Toby A Inkster said:

    > My PHP upload script on the intranet at work is 35 lines long
    > (and that does a decent amount of error checking). $150 for $35 lines of
    > code?


    theres no limit on the size of the file you can upload.

    --
    brucie
    16/December/2003 08:20:16 am kilo
     
    brucie, Dec 15, 2003
    #10
  11. Matt Fulford

    Richard Guest

    Leif K-Brooks wrote:

    > PW wrote:
    >> Take the easy way out, like I did.
    >>
    >> Buy ASPUpload.
    >>
    >> http://www.persits.com


    > Anyone who would pay $150 for an upload script is either insane, rich,
    > or using their boss's money.


    Not to mention totally ignorant.

    If they can develop the script, why can't you?
     
    Richard, Dec 15, 2003
    #11
  12. Matt Fulford

    PW Guest

    "William Tasso" <> wrote in message
    news:brlc3j$4m46u$-berlin.de...
    >
    > At 12 lines per day that works out at $50 per day. Good value I reckon

    ;o)
    >



    That was my opinion too. Why write "yet another" upload program, when I
    could just buy it for $150. I tried several others that were free prior to
    purchasing, and had all sorts of problems. Plus I was under time pressure
    from the client. So I bought a solution. Works really good too. :)
     
    PW, Dec 15, 2003
    #12
  13. Richard wrote:
    > Leif K-Brooks wrote:
    >
    > > PW wrote:
    > >> Take the easy way out, like I did.
    > >>
    > >> Buy ASPUpload.

    >
    > > Anyone who would pay $150 for an upload script is either insane,

    > rich, > or using their boss's money.
    >
    > Not to mention totally ignorant.


    really?

    > If they can develop the script, why can't you?


    The usual reasons that apply to any purchace vs build decision.

    I have the skills necessary to build a house and a car. I have no intention
    of building either, although I may turn my hand to a new garden shed now
    that brucie appears to have taken residence in the existing one.

    fyi: ASPupload is a server side component - not a script.

    --
    William Tasso - http://WilliamTasso.com
     
    William Tasso, Dec 16, 2003
    #13
  14. Matt Fulford

    brucie Guest

    in post <news:brlhq6$4hs8d$-berlin.de>
    William Tasso said:

    > I have the skills necessary to build a house and a car. I have no intention
    > of building either, although I may turn my hand to a new garden shed now
    > that brucie appears to have taken residence in the existing one.


    and i told you *last week* i wanted new carpet! where the hell is it?


    --
    brucie
    16/December/2003 11:20:33 am kilo
     
    brucie, Dec 16, 2003
    #14
  15. Matt Fulford

    Marc Nadeau Guest

    PW a écrit:

    >
    > "William Tasso" <> wrote in message
    > news:brlc3j$4m46u$-berlin.de...
    >>
    >> At 12 lines per day that works out at $50 per day. Good value I reckon

    > ;o)
    >>

    >
    >
    > That was my opinion too. Why write "yet another" upload program, when I
    > could just buy it for $150. I tried several others that were free prior
    > to
    > purchasing, and had all sorts of problems. Plus I was under time pressure
    > from the client. So I bought a solution. Works really good too. :)



    A $5 a line, i want to work for you sir. Choose your language.

    --
    On construit des maisons de fous pour faire croire à ceux
    qui n'y sont pas enfermés qu'ils ont encore la raison. Montaigne
     
    Marc Nadeau, Dec 16, 2003
    #15
  16. brucie wrote:

    > in post <news:p>
    > Toby A Inkster said:
    >
    >> My PHP upload script on the intranet at work is 35 lines long
    >> (and that does a decent amount of error checking). $150 for $35 lines of
    >> code?

    >
    > theres no limit on the size of the file you can upload.


    Yes there is -- PHP enforces this limit itself. Search in "/etc/php.ini"
    for "upload_max_filesize". Currently set to "2M" on my server and on the
    intranet in question.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
     
    Toby A Inkster, Dec 16, 2003
    #16
  17. Matt Fulford

    brucie Guest

    in post <news:p>
    Toby A Inkster said:

    >> theres no limit on the size of the file you can upload.


    > Yes there is -- PHP enforces this limit itself.


    i knew that

    > Currently set to "2M" on my server and on the intranet in question.


    wouldn't take much to shut down a 20Mb or even a 100Mb account. poor
    little me did it on a 15mb account with just my crappy 14.4k connection
    so i could prove a point to the "we don't need that" client. how about a
    100k or 200k limit if you're uploading thingys like images with a max
    limit of files.?

    --
    brucie
    16/December/2003 06:18:51 pm kilo
     
    brucie, Dec 16, 2003
    #17
  18. Matt Fulford

    Nico Schuyt Guest

    brucie wrote:

    > theres no limit on the size of the file you can upload.


    Some servers cut off when execution time exceeds a certain time (like mine:
    max 300 seconds)
    No matter if I use copy() or ftp_put()
    Nico
     
    Nico Schuyt, Dec 16, 2003
    #18
  19. Toby A Inkster <> wrote in message news:<>...
    > Leif K-Brooks wrote:
    >
    > > Anyone who would pay $150 for an upload script is either insane, rich,
    > > or using their boss's money.

    >
    > Very true. My PHP upload script on the intranet at work is 35 lines long
    > (and that does a decent amount of error checking). $150 for $35 lines of
    > code?
    >
    > <?php
    > header("Content-Type: text/html");
    >
    > function accept_upload ($d) {
    > $s = $_FILES['myfile']['tmp_name'];
    > move_uploaded_file($s,$d);


    Might be worth checking that the file has been moved - just in case.

    if (!move_uploaded_file($s,$d))
    # Chuck an error

    --
    Hywel
     
    Hywel Jenkins, Dec 16, 2003
    #19
  20. brucie wrote:

    > in post <news:p>
    > Toby A Inkster said:
    >
    >>> theres no limit on the size of the file you can upload.

    >
    >> Yes there is -- PHP enforces this limit itself.
    >> Currently set to "2M" on my server and on the intranet in question.

    >
    > wouldn't take much to shut down a 20Mb or even a 100Mb account.


    But the target partition on the intranet has about 1.5GB free, and on my
    own server I have about 15GB spare (really must tidy things up and get
    myself some more room!)

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
     
    Toby A Inkster, Dec 16, 2003
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tom
    Replies:
    1
    Views:
    315
    ScottFrye
    Oct 21, 2003
  2. George Ter-Saakov

    Re: Uploading a file to a file server?!?

    George Ter-Saakov, Oct 20, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    419
    ScottFrye
    Oct 21, 2003
  3. ScottFrye
    Replies:
    0
    Views:
    368
    ScottFrye
    Oct 21, 2003
  4. John Scalco
    Replies:
    1
    Views:
    417
    Steve C. Orr [MVP, MCSD]
    Jun 9, 2004
  5. Dung Ping
    Replies:
    10
    Views:
    999
    Chaddy2222
    Jan 16, 2006
Loading...

Share This Page