473,778 Members | 1,910 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

multiple images uploader

5 New Member
Any one please help me :i have upload the multiple image on server but i have problem to save the name of these image's name my code as following ...
(test1.php)
Expand|Select|Wrap|Line Numbers
  1. <?
  2.   include_once('connection_db.php');
  3.   $username=$_REQUEST['name'];
  4.   $index=$_REQUEST['cboxcata'];
  5.   if($_REQUEST){
  6.   for($i=1;$i<3;$i++){
  7.   $filename= $_FILES["userfile"]["name"][$i];
  8.                move_uploaded_file($_FILES["userfile"]["tmp_name"][$i], "../upload/".$filename);
  9.  
  10.  
  11.    }
  12.       $q="insert into person(image)values('$filename')";
  13.  
  14.       $r=mysql_query($q);
  15.      header("location:test.php");
  16.  
  17. }
  18.  
  19.  
  20. ?>
  21. htlm file is:
  22. <form name="" action="test1.php" method="post" enctype="multipart/form-data">
  23.  
  24.   <table width="350" border="0" align="center">
  25.     <tr>
  26.       <td colspan="2" align="center"><?=$msg?></td>
  27.     </tr>
  28.  
  29.     <tr>
  30.       <td align="left">Image1:</td>
  31.       <td align="left"><input type="file" name="userfile[1]" /></td>
  32.     </tr>
  33.     <tr>
  34.       <td align="left">Image2:</td>
  35.       <td align="left"><input type="file" name="userfile[2]" /></td>
  36.     </tr>
  37.     <!--<tr>
  38.       <td align="left">Image3:</td>
  39.       <td align="left"><input type="file" name="userfile[]" /></td>
  40.     </tr>
  41.     <tr>
  42.       <td align="left">Image4:</td>
  43.       <td align="left"><input type="file" name="userfile[]" /></td>
  44.     </tr>
  45.     <tr>
  46.       <td align="left">Image5:</td>
  47.       <td align="left"><label>
  48.         <input type="file" name="userfile[]" />
  49.  
  50.       </label></td>
  51.     </tr>-->
  52.     <tr>
  53.       <td colspan="2" align="left"><label>
  54.         <input type="submit" name="Submit" value="Submit" />
  55.       </label></td>
  56.     </tr>
  57.   </table>
  58.  
  59. </form>
Aug 24 '09 #1
1 1475
dgreenhouse
250 Recognized Expert Contributor
This may help you get started (you'll have to work out sanitizing the input and validation):
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <?php
  4.  
  5.   if (isset($_POST['submit'])) {
  6.     $uploads = "uploads/";
  7.     print '<pre>';
  8.     print_r($_FILES);
  9.     for ($i=0;$i<count($_FILES['files']['name']);$i++) {
  10.       print $_FILES['files']['name'][$i] . "<br>";
  11.       if (!$_FILES['files']['error'][$i]) {
  12.         move_uploaded_file(
  13.           $_FILES['files']['tmp_name'][$i],
  14.           $uploads . $_FILES['files']['name'][$i]
  15.         );
  16.       }
  17.     }
  18.     print '</pre>';
  19.   }
  20.  
  21. ?>
  22. <form method="post" action="" enctype="multipart/form-data">
  23. <input type="file" name="files[]"><br>
  24. <input type="file" name="files[]"><br>
  25. <input type="file" name="files[]"><br>
  26. <input type="submit" name="submit" value="Upload Files">
  27. </body>
  28. </html>
  29.  
Aug 26 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2023
by: Plex | last post by:
Ok, I've written this script which is supposed to take an image uploaded by a user and put it in to a database, then at a later date be able to extract the image from the database and display the image to the user. The problem is that whenever I try to display the image, all I get is an error message that the image contains errors. Can anyone tell me where or why these errors might be coming up? Here is my script (I'm pretty sure it's...
2
1895
by: Plex | last post by:
Ok, I had a more barebones version of this script working, but when I tried to put it in with my larger script, it broke. I think the problem lies somewhere in the uploading, but I'm not sure of this. Anyway, here's what I have: index.php --------------------------------- <? include("header.inc"); if (!isset($_SESSION) or ($_SESSION == "Guest")) {
3
3488
by: Arun | last post by:
Hi, I have simple question to ask. How to write multiple Binary files to the Browser using Asp.Net and Visual C#.net I have seen examples where single binary file is written to browser. -Regards Arun
2
1324
by: harikrishnan4u | last post by:
How can we check the image size in rad uploader this file uploader is in the rad editor??any one Know
5
2942
by: Good Man | last post by:
Hi everyone I was wondering if some people could comment on the new Flickr uploader at http://www.flickr.com/photos/upload/ I find a couple of things very intriguing, particuarly some things that i thought were impossible to do with javascript/client-side stuff 1) clicking "Choose photos" opens up a browser 'file' dialog with "Files of type:" pre-selected with jpg and bmp extensions. in addition, you can
1
1554
by: groupie | last post by:
Hi, I'm using the excellent Multiple file uploader ( http://the-stickman.com/web-development/javascript/multiple-file-uploader-mootools-version/ ) After selecting the files (as per the Defaults example on http://the-stickman.com/files/mootools/multiupload/ ), I use a Submit button to send the data to a second page: how can I retrieve the file names entered on the first page, as I don't understand the code that well. Thanks.
9
4508
by: torso | last post by:
Hi Does someone know a good tutorial for multiple file upload with xmlHttpRequest. I am trying to do directory upload. So I could choose directorys and upload those to the server. Another solution would be fake multiple file upload. It's takes only address of directorys and after choosing few address, you could push send button and PHP would do the rest.
2
2174
by: fran7 | last post by:
Hi, I wonder if anyone could tell me if there is a default upload folder for image uploads in this code or if the code references another file. It works fine but I am trying to change the upload folder for images and cannot find where its done. This bit confuses me as the application gcp, I simply dont know where it is. The only include in this page is just an upload include that has no other includes in it. If anyone can explain the...
6
2857
by: neovantage | last post by:
Hey all, i have installed Uber uploader on my server. and it is working perfectly. It shows progress bar after submitting form. I want that when i upload an image or a file it shows the progress in Popup fancy window like thickbox and Upload Page as well at behind the fancy screen untill unless the file uploading complete. here is the url Link where i install Uber Uploader latest version script. If some one guide me that how can i do that...
0
9470
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10127
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10069
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8957
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7475
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5500
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4033
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.