herghost Posted May 3, 2009 Share Posted May 3, 2009 Hi all, i can just not get this to work. Basically its just a couple of forms, the 1st adds information to a database and the second uploads a picture to a folder on the server. I have not yet done the code for uploading the info to the database, I am trying to get the picture upload to work first. Basically I just get to a white screen, no error, and the picture does not upload. Here are the pages: Page 1 - information <!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> <?php session_start(); include('include/database.php'); //include('include/auth.php'); ?> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Welcome to fanjunky.com! - New Music - Bands- MP3 - Tickets - Tour Dates - The Latest Band = <?php $sql = "SELECT * FROM user WHERE userid = '$userid'"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)) { { echo $row['bandname']; } } ?> </title> <meta name="keywords" content="" /> <meta name="description" content="" /> <link href="default.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <?php echo $_SESSION['SESS_USERID']; $userid = $_SESSION['SESS_USERID']; $sql = "SELECT * FROM user WHERE userid = $userid"; $result = mysql_query($sql) or die(mysql_error()); if ($result) { while ($row = mysql_fetch_array($result)) { $userid = $row["userid"]; if (is_dir('users/'.$userid) == FALSE) { mkdir('users/'.$userid); mkdir('temp/'.$userid); } } } ?> <?php include('include/header.php'); ?> <div id="page"> <div id="content"> <div class="post greenbox"> <div class="title"> <h1>band discography</h1> </div> <div class="entry"> <p>Please Fill In the Boxes To Add Your Album <p><form action="albumpic.php" name="step1" method="post"> <table width="95%" border="0" align="center" cellpadding="2" cellspacing="0"> <tr> <th>Album Name</th> <td><input name="albumname" type="text" id="albumname" size="75" /></td> </tr> <tr> <th>Year Released</th> <td><input name="released" type="text" id="released" size="10" maxlength="4" /></td> </tr> <tr> <th>Label</th> <td><input name="label" type="text" id="label" size="50" /></td> </tr> <tr> <th>Track 1</th> <td><input name="t1" type="text" id="t1" size="50" /></td> </tr> <tr> <th>Track 2</th> <td><input name="t2" type="text" id="t2" size="50" /></td> </tr> <tr> <th>Track 3</th> <td><input name="t3" type="text" id="t3" size="50" /></td> </tr> <tr> <th>Track 4</th> <td><input name="t4" type="text" id="t4" size="50" /></td> </tr> <tr> <th>Track 5</th> <td><input name="t5" type="text" id="t5" size="50" /></td> </tr> <tr> <th>Track 6</th> <td><input name="t6" type="text" id="t6" size="50" /></td> </tr> <tr> <th>Track 7</th> <td><input name="t7" type="text" id="t7" size="50" /></td> </tr> <tr> <th>Track 8</th> <td><input name="t8" type="text" id="t8" size="50" /></td> </tr> <tr> <th>Track 9</th> <td><input name="t9" type="text" id="t9" size="50" /></td> </tr> <tr> <th>Track 10</th> <td><input name="t10" type="text" id="t10" size="50" /></td> </tr> <tr> <th>Track 11</th> <td><input name="t11" type="text" id="t11" size="50" /></td> </tr> <tr> <th>Track 12</th> <td><input name="t12" type="text" id="t12" size="50" /></td> </tr> <tr> <th>Track 13</th> <td><input name="t13" type="text" id="t13" size="50" /></td> </tr> <tr> <th>Track 14</th> <td><input name="t14" type="text" id="t14" size="50" /></td> </tr> <tr> <th>Track 15</th> <td><input name="t15" type="text" id="t15" size="50" /></td> </tr> <tr> <th>Track 16</th> <td><input name="t16" type="text" id="t16" size="50" /></td> </tr> <tr> <th>Track 17</th> <td><input name="t17" type="text" id="t17" size="50" /></td> </tr> <tr> <th>Track 18</th> <td><input name="t18" type="text" id="t18" size="50" /></td> </tr> <tr> <th>Track 19</th> <td><input name="t19" type="text" id="t19" size="50" /></td> </tr> <tr> <th>Track 20</th> <td><input name="t20" type="text" id="t20" size="50" /></td> </tr> <tr> <td> </td> <td class="tdback"><input type="submit" name="Submit" value="Continue" /></td> <td class="tdback"> </td> </tr> </table> <p> </p> </form> </div> <div class="btm"> <div class="l"> <div class="r"> <p class="meta"> </p> </div> </div> </div> </div> <br/> <div class="two-columns"> <div class="columnA"> <div class="title red"> <h2>sponsers</h2> </div> <div class="content"> <script type="text/javascript"> google_ad_client = "pub-1087428711969548"; google_ad_slot = "3081294343"; google_ad_width = 250; google_ad_height = 250; </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> </div> </div> <div class="columnB"> <div class="title blue"> <h2>Random Bands</h2> </div> <div class="content"> <?php $sql = "SELECT * FROM user ORDER BY RAND() LIMIT 10"; $result = mysql_query($sql ,$con); while($myrow = mysql_fetch_array($result)) { echo "<table width ='90%'>"; echo "<tr>"; echo "<td>"; echo $myrow['bandname']; echo "</td>"; echo "<td>"; echo "<a href='newprofile.php?userid="; echo $myrow['userid']; echo "'>View</a>"; echo "</td>"; echo "</tr>"; echo "</table>"; } ?> </div> </div> <div class="btm"> </div> </div> </div> <!-- end content --> <!-- start sidebar --> <div id="sidebar"> <ul> <li> <h2>Sponsers</h2> <ul> <li><script type="text/javascript"><!-- google_ad_client = "pub-1087428711969548"; /* 250x250, created 4/14/09 */ google_ad_slot = "6665679490"; google_ad_width = 250; google_ad_height = 250; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></li> </ul> <h2>Sponsers</h2> <ul> <li><script type="text/javascript"><!-- google_ad_client = "pub-1087428711969548"; /* 250x250, created 4/14/09 */ google_ad_slot = "6665679490"; google_ad_width = 250; google_ad_height = 250; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></li> </ul> </li> </ul> </div> </div> <div style="clear: both;"> </div> <?php include('include/footer.php') ?> </body> </html> page 2 - Picture <!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> <?php session_start(); include('include/database.php'); include('include/header.php'); //include('include/auth.php'); ?> <?php $userid = $_SESSION['SESS_USERID']; ?> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Welcome to fanjunky.com! - New Music - Bands- MP3 - Tickets - Tour Dates - The Latest Band = <?php $sql = "SELECT * FROM user WHERE userid = '$userid'"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)) { { echo $row['bandname']; } } ?> </title> <meta name="keywords" content="" /> <meta name="description" content="" /> <link href="default.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <?php $userid = $_SESSION['SESS_USERID']; $_SESSION['albumname'] = $_POST['albumname']; $_SESSION['released'] = $_POST['released']; $_SESSION['label'] = $_POST['label']; $_SESSION['t1'] = $_POST['t1']; $_SESSION['t2'] = $_POST['t2']; $_SESSION['t3'] = $_POST['t3']; $_SESSION['t4'] = $_POST['t4']; $_SESSION['t5'] = $_POST['t5']; $_SESSION['t6'] = $_POST['t6']; $_SESSION['t7'] = $_POST['t7']; $_SESSION['t8'] = $_POST['t8']; $_SESSION['t9'] = $_POST['t9']; $_SESSION['t10'] = $_POST['t10']; $_SESSION['t11'] = $_POST['t11']; $_SESSION['t12'] = $_POST['t12']; $_SESSION['t13'] = $_POST['t13']; $_SESSION['t14'] = $_POST['t14']; $_SESSION['t15'] = $_POST['t15']; $_SESSION['t16'] = $_POST['t16']; $_SESSION['t17'] = $_POST['t17']; $_SESSION['t18'] = $_POST['t18']; $_SESSION['t19'] = $_POST['t19']; $_SESSION['t20'] = $_POST['t20']; ?> <div id="page"> <div id="content"> <div class="post greenbox"> <div class="title"> <h1>band discography - Album Cover</h1> </div> <div class="entry"> <p>Please upload the album cover</p> <p> <form action="do/portfolio.php" method="post" name="step2"> <input name="new_image" id="new_image" size="30" type="file" class="fileUpload" /> <button name="submit" type="submit" class="submitButton">Upload Image</button> </form> </p></div> <div class="btm"> <div class="l"> <div class="r"> <p class="meta"> </p> </div> </div> </div> </div> <br/> <div class="two-columns"> <div class="columnA"> <div class="title red"> <h2>sponsers</h2> </div> <div class="content"> <script type="text/javascript"> google_ad_client = "pub-1087428711969548"; google_ad_slot = "3081294343"; google_ad_width = 250; google_ad_height = 250; </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> </div> </div> <div class="columnB"> <div class="title blue"> <h2>Random Bands</h2> </div> <div class="content"> <?php $sql = "SELECT * FROM user ORDER BY RAND() LIMIT 10"; $result = mysql_query($sql ,$con); while($myrow = mysql_fetch_array($result)) { echo "<table width ='90%'>"; echo "<tr>"; echo "<td>"; echo $myrow['bandname']; echo "</td>"; echo "<td>"; echo "<a href='newprofile.php?userid="; echo $myrow['userid']; echo "'>View</a>"; echo "</td>"; echo "</tr>"; echo "</table>"; } ?> </div> </div> <div class="btm"> </div> </div> </div> <!-- end content --> <!-- start sidebar --> <div id="sidebar"> <ul> <li> <h2>Sponsers</h2> <ul> <li><script type="text/javascript"><!-- google_ad_client = "pub-1087428711969548"; /* 250x250, created 4/14/09 */ google_ad_slot = "6665679490"; google_ad_width = 250; google_ad_height = 250; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></li> </ul> <h2>Sponsers</h2> <ul> <li><script type="text/javascript"><!-- google_ad_client = "pub-1087428711969548"; /* 250x250, created 4/14/09 */ google_ad_slot = "6665679490"; google_ad_width = 250; google_ad_height = 250; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></li> </ul> </li> </ul> </div> <!-- end sidebar --> <!-- end sidebar --> <!-- end sidebar --> </div> <!-- end page --> <div style="clear: both;"> </div> <?php include('include/footer.php') ?> </body> </html> and finally the "do" code <?php session_start(); include('../include/database.php'); if(isset($_POST['submit'])){ if (isset ($_FILES['new_image'])){ $file_name = $_FILES['new_image']['name']; $getExt = explode ('.', $file_name); $file_ext = $getExt[count($getExt)-1]; // Adding extension verification $allowed_ext = "|jpg|png|gif|jpeg|svg|bmp|"; if (strpos($allowed_ext, "|".strtolower($file_ext)."|")===false) die("Extension: $file_ext is not allowed!"); // End extension verification $imagename = "mainpic1.jpg"; $source = $_FILES['new_image']['tmp_name']; $target = "C:/wamp/www/fanjunky/users/$userid/$imagename"; move_uploaded_file($source, $target); $imagepath = $imagename; $save = "C:/wamp/www/fanjunky/users/$userid/$imagepath"; //This is the new file you saving $file = "C:/wamp/www/fanjunky/temp/$userid"; //This is the original file } } ?> Any ideas? Link to comment https://forums.phpfreaks.com/topic/156690-multi-pag-form-and-picture-upload-help/ Share on other sites More sharing options...
mattal999 Posted May 3, 2009 Share Posted May 3, 2009 Well, you don't have any echos on the do page, so it will produce a white screen... Try adding an echo at the end of it. Link to comment https://forums.phpfreaks.com/topic/156690-multi-pag-form-and-picture-upload-help/#findComment-825081 Share on other sites More sharing options...
herghost Posted May 3, 2009 Author Share Posted May 3, 2009 Well I have just echo'd the username and that works fine, but still no picture uploaded. Link to comment https://forums.phpfreaks.com/topic/156690-multi-pag-form-and-picture-upload-help/#findComment-825105 Share on other sites More sharing options...
mattal999 Posted May 4, 2009 Share Posted May 4, 2009 Should $target = "C:/wamp/www/fanjunky/users/$userid/$imagename"; not just be $target = "C:/wamp/www/fanjunky/users/$userid/";? Link to comment https://forums.phpfreaks.com/topic/156690-multi-pag-form-and-picture-upload-help/#findComment-825570 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.