Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

357
Views
Cargue y almacene la imagen en la base de datos con RedBean PHP

Tengo 2 archivos: signup.php y profile.php . Cuando me registro en signup.php con RedBean PHP, todo funciona, pero en la página de profile , cuando quiero cargar y mostrar mi imagen, no puedo hacerlo. Phpmyadmin crea una nueva fila y no puedo vincular la imagen con un usuario específico. Ayude a resolverlo usando RedBean, también agregue ajax para no reiniciar la página si es posible.

html:

 <form method="post" enctype="multipart/form-data"> <label>Picture Profile</label> <input type="file" name="profile" class="form-control" required="" accept="*/image"> <button type="submit" name="btn-add" style="color: red;">Add New </button> </form>

php:

 <?php if(isset($_POST['btn-add'])) { $name=$_POST['user_name']; $images=$_FILES['profile']['name']; $tmp_dir=$_FILES['profile']['tmp_name']; $imageSize=$_FILES['profile']['size']; $upload_dir='uploads/'; $imgExt=strtolower(pathinfo($images,PATHINFO_EXTENSION)); $valid_extensions=array('jpeg', 'jpg', 'png', 'gif', 'pdf'); $picProfile=rand(1000, 1000000).".".$imgExt; move_uploaded_file($tmp_dir, $upload_dir.$picProfile); $stmt=$db_conn->prepare('INSERT INTO tbl_user(username, picProfile) VALUES (:uname, :upic)'); $stmt->bindParam(':uname', $name); $stmt->bindParam(':upic', $picProfile); if($stmt->execute()) { ?> <script> alert("new record successul"); window.location.href=('index.php'); </script> <?php }else { ?> <script> alert("Error"); window.location.href=('index.php'); </script> <?php } } ?>

Muchas gracias

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!