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 7 of 7
  1. #1
    EMT
    EMT is offline
    Junior Member
    Join Date
    May 2008
    Location
    Wisconsin USA
    Posts
    17
    Member #
    16877
    I'm designing a site to allow members to upload videos to my server (like Youtube). I want them to upload 1video, 1 image and fill out various fieds on one form. When submitted I want the form to send me an email with the uploaded file names and the various data from the other form fields. I've set up the members area and can upload files (not as secure as I'd like) but my problem now is with the multipart/form-data. I cannot figure out how to make it send me an email. It seemed like it would be an easy fix but after trying on and off for about 6 months now I'm getting close to giving up on doing it myself. I tried making the process more than one form by having the 1st form upload the files and then send the uploaded file names to the next form but that wouldn't work either. It would send the other form fields but not the uploaded file names. Mabe I gave up to quickly but if this could work my problem would be solved. Any suggestions would be greatly appreciated.

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    What exactly do you need help on? What do you mean by does not work?

    Recently when I was developing some type of file uploader I forgot to use the correct global array ($_FILES and not $_POST).

  4. #3
    EMT
    EMT is offline
    Junior Member
    Join Date
    May 2008
    Location
    Wisconsin USA
    Posts
    17
    Member #
    16877
    Quote Originally Posted by bfsog
    What exactly do you need help on? What do you mean by does not work?

    Recently when I was developing some type of file uploader I forgot to use the correct global array ($_FILES and not $_POST).
    Thanks for the quick response. I dont know what a global array is. Do you meen for the method="post" part of the form? I thought this had to be "post" for file uploads using multipart/form-data.
    When the form is processed I want the form to email me with the uploaded file names and the data from the other form fields (their name, email adress etc...). Can this be done with the forms hidden fields and actions?

  5. #4
    EMT
    EMT is offline
    Junior Member
    Join Date
    May 2008
    Location
    Wisconsin USA
    Posts
    17
    Member #
    16877
    bfsog I noticed at your site you allow image uploads. In the source code of your upload page it doesn't look like you receive an email when there uploaded. Or do you?

  6. #5
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Do you mean www.laurencekirk.info?
    That is powered by a CMS that I designed specifically for that, I developed a feature into it so I can go in and turn notifications on/off. Right now it is set to off, the only notification I get is logging into the Admin panel.

    Emailing you the file names plus other data can be done, what server side language are you using?

  7. #6
    EMT
    EMT is offline
    Junior Member
    Join Date
    May 2008
    Location
    Wisconsin USA
    Posts
    17
    Member #
    16877
    I'm using php.

  8. #7
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Below is an example of submitting a text value (entered by the user through a form) and a file (Gin, chosen by the user).

    When you submit the form your output will be something like
    Bob wants to upload file.jpg
    HTML Code:
    <html>
    
    <head>
    
    	<title>Email filenames plus other form field values</title>
    
    </head>
    
    <body>
    
    	<form id="emailer" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
    
    		<p>Name: <input type="text" name="userName" id="userName" /></p>
    
    		<p>File: <input type="file" name="userFile" id="userFile" /></p>
    
    		<p><input type="submit" name="submit" value="Send File and text value" />
    
    	</form>
    
    	<?php
    
    		if(array_key_exists('submit', $_POST))
    		{
    			$username = $_POST['userName'];
    			$filename = $_FILES['userFile']['name'];
    			echo "<p>$username wants to upload $filename</p>";
    		}
    	?>
    
    </body>
    </html>
    So it is now just a case of formatting it to suit your needs and emailing.


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 11:06 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com