Current location: Hot Scripts Forums » Programming Languages » PHP » Multiple field, file upload form

Multiple field, file upload form

 
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 07-11-05, 12:21 PM
berlamont berlamont is offline
New Member
 
Join Date: Jun 2005
Location: michigan
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question Multiple field, file upload form

I have a perfectly working upload form at the moment, but I am having a hard time figureing out how to add the ability to generate other fields to submit along with the upload. Has anyone ever made a file upload form that submits other information such as the authors name (i'm uploading documents). Would it be hard to have a table generate from a form like that after a file was uploaded? I'm thinking I could store both the author and file in an mysql database, but would I have to separate that from the actual upload script?

Heres what I have so far:

PHP Code:
<?php 
  $numfile 
20
  
$servdir  "my file dir"
  if (
$_POST
 { 
    for (
$i=0;$i<$numfile;$i++) 
    { 
      if (
trim($_FILES['myfiles']['name'][$i])!=""
      { 
        
$newfile $servdir.$_FILES['myfiles']['name'][$i]; 
        
move_uploaded_file($_FILES['myfiles']['tmp_name'][$i], $newfile); 
        
$x++; 
      } 
    } 
 } 
  if (isset(
$x)&&$x>0) print "All went well.<br>"
  print 
"<form method='post' enctype='multipart/form-data'>"
  for(
$i=0;$i<$numfile;$i++) 
  { 
    print 
"<input type='file' name='myfiles[]' size='30'><br>"
  } 
  print 
"<input type='submit' name='action' value='Upload'>"
  print 
"</form>"
?>

Last edited by berlamont; 07-11-05 at 12:24 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP upload prob minority ASP 1 06-27-05 09:35 AM
Multiple form fields saved in one mysql field?? cebuy PHP 4 10-15-04 01:08 PM
formmail problem gscraper Perl 12 08-27-04 04:06 AM
transfer multiple value of a form field to another field ore JavaScript 2 06-18-04 09:50 PM
Disable form fields to be submitted RickyRod JavaScript 2 05-24-04 11:15 AM


All times are GMT -5. The time now is 11:49 PM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.