PHP - Moved: Document Upload Form
This topic has been moved to JavaScript Help.
http://www.phpfreaks.com/forums/index.php?topic=334078.0 Similar Tutorialshow do I make document upload fields like the ones that are on this website where there is a link at the bottom to make another field appear, or make it so that a new field automatically appears when the first one has info in it. Does this make sense? and also how would i make these submit with the form seeing as that they would have different field names, wouldn't they? so I want to know how I could upload a document associated with an event.......with a form upload.......but where do I store it at and make it display in the view page for the event......? Hi everyone. I have been looking for a PHP upload script that handles various different document types like PDF, DOC and XLS. So far all I have found is image upload scripts. Can anyone point me in the right direction? I would be most greatful. Thank you! Hello, I had created a form for users to upload their resumes (only word documents & 1 MB allowed as size), then email it after its been successfully uploaded. Any help? Thanks in advance Hi guys, I have created a php script (with alot of help from others) that allows me to have a login area on my website. When the user logs onto their page - they obviously cannot see the others profile. My next task is to be able to upload PDF documents to appear on their profiles. The PDF's will be specific to them. The main problems I have a 1/ They cannot be able to view any PDF but their own. 2/ How do I create a form that knows where to send and display the link? I guess it is using the user id & name etc? I will not actually be the one uploading the files else I would just sit and tediously link each form to each profile. This must be done by my secretary via a file upload form that I will password protect. I basically want her to be able to log in and be presented with a document upload form. The form will have a dropdown list of the clients name and a document upload part. From uploading it will then appear on the users page. If anyone could help it would be amazing! I am fairly new to PHP although am getting better with my understanding. Hopefully I will become as good as you lot one day! Cheers in advance This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=354333.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=316747.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=320005.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=358604.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=310954.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=357648.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=314887.0 Hi- the code below lets me upload a CSV file to my database if I have 1 field in my database and 1 column in my CSV. I need to add to my db "player_id" from the CVS file and "event_name" and "event_type" from the form... any ideas??? here's the code: Code: [Select] <?php $hoststring =""; $database = ""; $username = ""; $password = ""; $makeconnection = mysql_pconnect($hoststring, $username, $password); ?> <?php ob_start(); mysql_select_db($database, $makeconnection); $sql_get_players=" SELECT * FROM tabel ORDER BY player_id ASC"; // $get_players = mysql_query($sql_get_players, $makeconnection) or die(mysql_error()); $row_get_players = mysql_fetch_assoc($get_players); // $message = null; $allowed_extensions = array('csv'); $upload_path = '.'; //same directory if (!empty($_FILES['file'])) { if ($_FILES['file']['error'] == 0) { // check extension $file = explode(".", $_FILES['file']['name']); $extension = array_pop($file); if (in_array($extension, $allowed_extensions)) { if (move_uploaded_file($_FILES['file']['tmp_name'], $upload_path.'/'.$_FILES['file']['name'])) { if (($handle = fopen($upload_path.'/'.$_FILES['file']['name'], "r")) !== false) { $keys = array(); $out = array(); $insert = array(); $line = 1; while (($row = fgetcsv($handle, 0, ',', '"')) !== FALSE) { foreach($row as $key => $value) { if ($line === 1) { $keys[$key] = $value; } else { $out[$line][$key] = $value; } } $line++; } fclose($handle); if (!empty($keys) && !empty($out)) { $db = new PDO( 'mysql:host=host;dbname=db', 'user', 'pw'); $db->exec("SET CHARACTER SET utf8"); foreach($out as $key => $value) { $sql = "INSERT INTO `table` (`"; $sql .= implode("`player_id`", $keys); $sql .= "`) VALUES ("; $sql .= implode(", ", array_fill(0, count($keys), "?")); $sql .= ")"; $statement = $db->prepare($sql); $statement->execute($value); } $message = '<span>File has been uploaded successfully</span>'; } } } } else { $message = '<span>Only .csv file format is allowed</span>'; } } else { $message = '<span>There was a problem with your file</span>'; } } ob_flush();?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>CSV File Upload</title> </head> <body> <form class="form" action="" method="post" enctype="multipart/form-data"> <h3>Select Your File</h3> <p><?php echo $message; ?></p> <input type="file" name="file" id="file" size="30" /> <br/> <label>Event Name:</label><input name="event_name" type="text" value="" /> <br/> <label>Event Type:</label><input name="event_type" type="text" value="" /> <br/> <input type="submit" id="btn" class="button" value="Submit" /> </form> <br/> <h3>Results:</h3> <?php do { ?> <p><?php echo $row_get_players['player_id'];?></p> <?php } while ($row_get_players = mysql_fetch_assoc($get_players)); ?> </body> </html> This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=349362.0 This topic has been moved to Editor Help (Dreamweaver, Zend, etc). http://www.phpfreaks.com/forums/index.php?topic=343605.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=330946.0 I've been using php for a while now to create forms, up until now i've always transmitted the form data to a new php document that then processes them. I wanna take this to the next level and start trying to process the data within the same document. I know this has something to do with checking if the submit button is pressed and then processing the submitted data but thats about as far as my knowledge goes. Can anyone help me out on how i can achieve this type of thing. The reason is that i've found a way to execute php code within a joomla 1.6 environment without having to use the iframe option. I know the iframe option may be easier in a way of doing things but its out of the question. The final fase of the php will output code that will trigger a specific joomla plugin to do some specific action. If i pull a php document via an iframe the plugin doesnt trigger as it only gets triggered after the joomla "afterRender" (or something" has executed. If i use the iframe option then that rendering never gets used so the plugin doesnt get triggered. So in a nutshell, i wanna create forms that submit data and that data gets processed in the same document (in this case joomla article). How do i go about doing this. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=341970.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=357764.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=346271.0 |