如何在php中使用相同的格式上传多个不同格式的文件

iq0todco  于 2021-06-25  发布在  Mysql
关注(0)|答案(0)|浏览(295)

我想保存所有的输入文件,如apk和屏幕截图和标志在不同的文件夹。并将数据存储在php sql数据库中。。帮助我做到这一点,我想在文件夹中存储文件/logo,文件/apk,文件/ss1文件/ss2等,为特定的img。
我想使用php并将记录存储到mysql数据库
这是我的密码。。请跑来帮我找到问题的解决办法请帮我。。

var currentTab = 0; // Current tab is set to be the first tab (0)
showTab(currentTab); // Display the crurrent tab

function showTab(n) {
  // This function will display the specified tab of the form...
  var x = document.getElementsByClassName("tab");
  x[n].style.display = "block";
  //... and fix the Previous/Next buttons:
  if (n == 0) {
    document.getElementById("prevBtn").style.display = "none";
  } else {
    document.getElementById("prevBtn").style.display = "inline";
  }
  if (n == (x.length - 1)) {
    document.getElementById("nextBtn").innerHTML = "Submit";
	document.getElementById("nextBtn").style.display = "none";
  } 
  else {
    document.getElementById("nextBtn").innerHTML = "Next";
  }
  //... and run a function that will display the correct step indicator:
  fixStepIndicator(n)
}

function nextPrev(n) {
  // This function will figure out which tab to display
  var x = document.getElementsByClassName("tab");
  // Exit the function if any field in the current tab is invalid:
  if (n == 1 && !validateForm()) return false;
  // Hide the current tab:
  x[currentTab].style.display = "none";
  // Increase or decrease the current tab by 1:
  currentTab = currentTab + n;
  // if you have reached the end of the form...
  if (currentTab >= x.length) {
    // ... the form gets submitted:
    document.getElementById("regForm").submit();
    return false;
  }
  // Otherwise, display the correct tab:
  showTab(currentTab);
}

function validateForm() {
  // This function deals with validation of the form fields
  var x, y, i, valid = true;
  x = document.getElementsByClassName("tab");
  y = x[currentTab].getElementsByTagName("input");
  // A loop that checks every input field in the current tab:
  for (i = 0; i < y.length; i++) {
    // If a field is empty...
    if (y[i].value == "") {
      // add an "invalid" class to the field:
      y[i].className += " invalid";
      // and set the current valid status to false
      valid = false;
    }
  }
  // If the valid status is true, mark the step as finished and valid:
  if (valid) {
    document.getElementsByClassName("step")[currentTab].className += " finish";
  }
  return valid; // return the valid status
}

function fixStepIndicator(n) {
  // This function removes the "active" class of all steps...
  var i, x = document.getElementsByClassName("step");
  for (i = 0; i < x.length; i++) {
    x[i].className = x[i].className.replace(" active", "");
  }
  //... and adds the "active" class on the current step:
  x[n].className += " active";
}
body{
	background-image: url("img/bga.png");
	background-repeat: repeat;

		}

	* {
		box-sizing: border-box;
		}

		body {
		background-color: #f1f1f1;
		}

		#regForm {
		background-color: #ffffff;
		margin: 100px auto;
		font-family: Raleway;
		padding: 40px;
		width: 70%;
		min-width: 300px;
		border-style: solid;
    border-width: 2px;
		}

		h1 {
		text-align: center;  
		}

		input {
		padding: 10px;
		width: 100%;
		font-size: 17px;
		font-family: Raleway;
		border: 1px solid #aaaaaa;
		}

		/* Mark input boxes that gets an error on validation: */
		input.invalid {
		background-color: #ffdddd;
		}

		/* Hide all steps by default: */
		.tab {
		display: none;
		}

		button {
		background-color: #4CAF50;
		color: #ffffff;
		border: none;
		padding: 10px 20px;
		font-size: 17px;
		font-family: Raleway;
		cursor: pointer;
		}

		button:hover {
		opacity: 0.8;
		}

		#prevBtn {
		background-color: #bbbbbb;
		}

		/* Make circles that indicate the steps of the form: */
		.step {
		height: 15px;
		width: 15px;
		margin: 0 2px;
		background-color: #bbbbbb;
		border: none;  
		border-radius: 50%;
		display: inline-block;
		opacity: 0.5;
		}

		.step.active {
		opacity: 1;
		}

		/* Mark the steps that are finished and valid: */
		.step.finish {
		background-color: #4CAF50;
		}
<html>
<head>
<title>
</title>
 <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
		<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    </head>
<body>

		<div class="container">

						<form id="regForm" method="post" action="newapp.php">
				<h1>Upload App To Apps In - Bilwg</h1>
				<!-- One "tab" for each step in the form: -->
				<div class="tab">APK & Name:
				<br>
				<p><label for="application">Select APK</label></p>
					<p><input type="file" name="apk" id="apk" class="form-control" accept=".apk" required /> </p>
					<p><input type="text" placeholder="Application Name..." name="aname"></p>
					</div>

				<div class="tab">Basic Info:
				<br>
					<p><label>Short Description</label></p>
					<p><input type="text" name="sdes" required /></p>
					<p><label>Long Description</label></p>
					<p><input type="text" name="ldes" required /></p>
					<p><label>Logo (512 X 512 png)</label></p>
					<p><input type="file" name="logo" id="logo" class="form-control" accept=".png" required /></p>
					<p><label>Feature Image (1024 X 1024)</label></p>
					<p><input type="file" name="fimg" id="fimg" class="form-control" accept="image/x-png,image/gif,image/jpeg" required /></p>

					<p><label>Select Screenshot 1 (Please rename as application_name_1ss)</label></p>
					<p><input type="file" name="ss1" id="ss1" class="form-control" accept="image/x-png,image/gif,image/jpeg" required /></p>
					<p><label>Select Screenshot 2 (Please rename as application_name_2ss)</label></p>
					<p><input type="file" name="ss2" id="ss2" class="form-control" accept="image/x-png,image/gif,image/jpeg" required /></p>
					<p><label>Select Screenshot 3 (Please rename as application_name_3ss)</label></p>
					<p><input type="file" name="ss3" id="ss3" class="form-control" accept="image/x-png,image/gif,image/jpeg" required /></p>
					<p><label>Select Screenshot 4 (Please rename as application_name_4ss)</label></p>
					<p><input type="file" name="ss4" id="ss4" class="form-control" accept="image/x-png,image/gif,image/jpeg" /></p>
					<p><label>Select Screenshot 5 (Please rename as application_name_5ss)</label></p>
					<p><input type="file" name="ss5" id="ss5" class="form-control" accept="image/x-png,image/gif,image/jpeg" /></p>
				</div>
				<div class="tab">Other Info:
				<center>
				<p><label>Type Of Application </label></p>
					<p><select name="type" required>
							<option value="Select">Select</option>
							<option value="Application">Application</option>
							<option value="Games">Games</option>
						</select>
					</p>
					</center>
					<p><label><center>Contains Ads</center> </label></p>

					<p><center>Yes </center><input type="radio" name="ads" value="Yes"> </p>
					<p> <center>No</center><input type="radio" name="ads" value="No"></p>
					<center>
					<label>Catogery Of App </label>
					<select name="cato" required>
							<option value="Select">Select</option>
							<option value="art">Art And Design</option>
							<option value="Auto & Vahical">Auto & Vahical</option>
							<option value="Beauty">Beauty</option>
							<option value="Books And Reference">Books And Reference</option>
							<option value="Business">Business</option>
							<option value="Comics">Comics</option>
							<option value="Communication">Communication</option>
							<option value="Dating">Dating</option>
							<option value="Educator">Educator</option>
							<option value="Entertatinment">Entertatinment</option>
							<option value="Event">Events</option>
							<option value="Fimaly">Family</option>
							<option value="Finance">Finance</option>
							<option value="Food & Drink">Food & Drink</option>
							<option value="Games">Games</option>
							<option value="Google Cast">Google Cast</option>
							<option value="Health & Fitness">Health & Fitness</option>
							<option value="House & Home">House & Home</option>
							<option value="Librabry & Demo">Librabry & Demo</option>
							<option value="Lifestyle">Lifestyle</option>
							<option value="Maps And Navigatin">Maps And Navigatin</option>
							<option value="Medical">Medical</option>
							<option value="Music & Audio">Music & Audio</option>
							<option value="News & Magazines">News & Magazines</option>
							<option value="Parenting">Parenting</option>
							<option value="Personalisation">Personalisation</option>
							<option value="Photography">Photography</option>
							<option value="Productivity">Productivity</option>
							<option value="Shopping">Shopping</option>
							<option value="Social">Social</option>
							<option value="Sports">Sports</option>
							<option value="Tools">Tools</option>
							<option value="Travel & Local">Travel & Local</option>
							<option value="Video Player & Editior">Video Player & Editior</option>
							<option value="Wear OS">Wear OS</option>
							<option value="Wheather">Weather</option>

						</select>

					</center>
				</div>
				<div class="tab">Final Stage:
					<p><label>Content Rating(in Age)</label></p>		
					<p><input type="number" name="age" min="3" max="25">+</p>
					<p><label>Apps Permission </label></p>
					<p><textarea name="ap" width="100%" required></textarea></p>
					<p><label>Privecy Policy </label> </p>
					<p><textarea name="pp" width="60%" required></textarea></p>

					<input type="submit" name="submit" value="Publish" />
				</div>
				<div style="overflow:auto;">
					<div style="float:right;">
					<button type="button" id="prevBtn" onclick="nextPrev(-1)">Previous</button>
					<button type="button" name="submit" id="nextBtn"  onclick="nextPrev(1)">Next</button>
					</div>
				</div>
				<!-- Circles which indicates the steps of the form: -->
				<div style="text-align:center;margin-top:40px;">
					<span class="step"></span>
					<span class="step"></span>
					<span class="step"></span>
					<span class="step"></span>
				</div>
				</form>

				</div>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题