Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 10 of 10
  1. #1
    Junior Member nmaster64's Avatar
    Join Date
    Aug 2006
    Location
    NCSU
    Posts
    19
    Member #
    13814
    I'm needing a page on a site with a form that does two things: takes a file and uploads it to the server (supposed to be an image but I'll probably allow any filetype, user error should be practically impossible in this particular case), then sends out a notification email.

    What's the best way to approach file uploads? In this case, I don't have to do any operations on the files or keep special track of 'em in any way, so I suppose the simplest possible implementation will do. Is it doable w/o using CGI/Perl, PHP, or, heaven-forbid ASP? I have not created an upload form w/o those before, and was wondering if there's a possible HTML form implementation usable in this case...

    I need to get this working today, so I guess I'm looking for whatever I can throw up and get working the fastest...

  2.  

  3. #2
    Senior Member Shani's Avatar
    Join Date
    Nov 2004
    Posts
    1,140
    Member #
    8171
    I don't know if there's a way to do it without using a server-side language. It's pretty straightforward in PHP. I don't know about the others.

    From the W3 Schools: File Upload, and Email.
    Shani

    I have an eye for detail like you'd never believe.

  4. #3
    Junior Member nmaster64's Avatar
    Join Date
    Aug 2006
    Location
    NCSU
    Posts
    19
    Member #
    13814
    What do ya think is easier/faster, PHP or CGI?

  5. #4
    Senior Member Shani's Avatar
    Join Date
    Nov 2004
    Posts
    1,140
    Member #
    8171
    I personally have never studied CGI at all, so I may not be the best person to ask. But I'm a beginner at PHP, and I know how to do a file upload and send email.

    Database access will be preferable for the PHP, but a much easier and far less secure method would involve creating a directory. I believe that tutorial goes into it on some level. If you have PHP on your server, you probably have phpMyAdmin for a MySQL database, and it has a very easy-to-use interface.
    Shani

    I have an eye for detail like you'd never believe.

  6. #5
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    I'd have to suggest PHP for you. The help file has a good explaination for making an upload, along with many useful ideas, notes, and warnings.

    HTML itself, as far as I know, has no filehandling functions. Neither does JS. So a server-side has to be easier, if not a must.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  7. #6
    Junior Member nmaster64's Avatar
    Join Date
    Aug 2006
    Location
    NCSU
    Posts
    19
    Member #
    13814
    I've always used CGI for email...I can't get the PHP mail function to work. I guess my server's not set to handle it...the file upload is working great though...

  8. #7
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Post your code and we will have a look for you.

  9. #8
    Junior Member nmaster64's Avatar
    Join Date
    Aug 2006
    Location
    NCSU
    Posts
    19
    Member #
    13814
    I'm just calling the mail function in PHP...
    PHP Code:
    <?php 
    $to 
    "myemail@mydomain.com";
    $subject "The Subject";
    $message "A Message";
    $headers "From: someonelse@theirdomain.com";
    mail($to,$subject,$message,$headers);
    ?>
    I guess there just isn't a PHP email system set up on my server...

  10. #9
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    What happens when you try to send the email? Maybe the email address you are trying to email is having some problems.

    Try something like: http://email.about.com/cs/phpemailtips/qt/et031202.htm

  11. #10
    Junior Member nmaster64's Avatar
    Join Date
    Aug 2006
    Location
    NCSU
    Posts
    19
    Member #
    13814
    *doh!* I've been updating the wrong file the whole time...it's all working now. Thanks.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:32 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com