Jump to content

Search the Community

Showing results for tags 'php images uploading'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hello there. I have a problem with inserting a name of the pictures in my table. My table have just 3 fields: id, photo & name. This is html code: <form action="nextpage.php" method="post" enctype="multipart/form-data"> <table> <tr> <td valign="top">Upload Image: </td> <td> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"><input name="photo" type="file" size="30"><br /> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"><input name="photo1" type="file" size="30"><br /> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"><input name="photo2" type="file" size="30"><br /> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"><input name="photo3" type="file" size="30"><br /> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"><input name="photo4" type="file" size="30"><br /> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"><input name="photo5" type="file" size="30"></td> </tr> <tr> <td> <input type="submit" value="Add" value="Wide button"></td> </tr> </table> </form> This is all php code: <?php $photo0=($_FILES['photo']['name']); $photo1=($_FILES['photo1']['name']); $photo2=($_FILES['photo2']['name']); $photo3=($_FILES['photo3']['name']); $photo4=($_FILES['photo4']['name']); $photo5=($_FILES['photo5']['name']); //This is the directory where images will be saved $target = "images/upload/"; $targetx = $target . basename( $_FILES['photo']['name']); //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $targetx)) { //Tells you if its all ok } else { //Gives and error if its not } $targetx = $target . basename( $_FILES['photo1']['name']); //Writes the photo to the server if(move_uploaded_file($_FILES['photo1']['tmp_name'], $targetx)) { //Tells you if its all ok } else { //Gives and error if its not } $targetx = $target . basename( $_FILES['photo2']['name']); //Writes the photo to the server if(move_uploaded_file($_FILES['photo2']['tmp_name'], $targetx)) { //Tells you if its all ok } else { //Gives and error if its not } $targetx = $target . basename( $_FILES['photo3']['name']); //Writes the photo to the server if(move_uploaded_file($_FILES['photo3']['tmp_name'], $targetx)) { //Tells you if its all ok } else { //Gives and error if its not } $targetx = $target . basename( $_FILES['photo4']['name']); //Writes the photo to the server if(move_uploaded_file($_FILES['photo4']['tmp_name'], $targetx)) { //Tells you if its all ok } else { //Gives and error if its not } $targetx = $target . basename( $_FILES['photo5']['name']); //Writes the photo to the server if(move_uploaded_file($_FILES['photo5']['tmp_name'], $targetx)) { //Tells you if its all ok } else { //Gives and error if its not } include "phpscripts/connect_to_mysql.php"; foreach(array($photo0, $photo1, $photo2, $photo3, $photo4, $photo5) as $value){ $sql="INSERT INTO `images` (`photo`,`name`) VALUES('".$value."', 'spain')"; } $result=mysql_query($sql); I think i have a problem in this fews lines: foreach(array($photo0, $photo1, $photo2, $photo3, $photo4, $photo5) as $value){ $sql="INSERT INTO `images` (`photo`,`name`) VALUES('".$value."', 'spain')"; } Also if it s possible to stop to do not upload if the user doesn't choose a files. Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.