Go Back   CodeCall Programming Forum > Web Development Forum > PHP Forum
Register Blogs Search Today's Posts Mark Forums Read

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-27-2009, 12:50 AM
Learning Programmer
 
Join Date: Apr 2008
Location: India
Posts: 32
Divya is an unknown quantity at this point
To upload multiple image files

I want to upload 9 image files and if i click the submit button,all the images should be sent to a folder named "images" and the thumbnail images of those images should be created and sent to a folder named "thumbnails" inside "images" folder.Also,the image path should be sent to the database..Is it possible??if so,pls guide me..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-27-2009, 05:24 AM
amrosama's Avatar
Code Warrior
/////////|||||\\\\\\\\\
 
Join Date: Aug 2007
Location: Pyramids st, Giza, Egypt
Age: 21
Posts: 8,112
amrosama is a splendid one to beholdamrosama is a splendid one to beholdamrosama is a splendid one to beholdamrosama is a splendid one to beholdamrosama is a splendid one to beholdamrosama is a splendid one to beholdamrosama is a splendid one to behold
Send a message via MSN to amrosama
Re: To upload multiple image files

sorry for that spam above,
ive wrote a tutorial about that heres the link
__________________
im a code-warrior, see my avatar
who said arabs cant dance?
and who said arabs cant drive??!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-07-2009, 01:44 AM
Newbie
 
Join Date: Jul 2009
Posts: 1
jatin is an unknown quantity at this point
Re: To upload multiple image files

hi divya...........
below is the code how to upload multiple image files ,this code is in asp.net but easily can be converted to php .i m posting this code only for clarifying the basic concept behind uploading photos.

Code:
protected void Button1_Click(object sender, EventArgs e)
    {

        //for File Uploading
     
//Here FileUpload is a asp.net control but u can use the html file upload //control 
       
//FileUpload1 is for uploading first file
        FileUpload fileuploader;
        Label labeler;
        fileuploader = FileUpload1;
        labeler = Label1;
        callme(fileuploader, labeler);

//FileUpload2 is for uploading second file
        fileuploader = FileUpload2;
        labeler = Label2;
        callme(fileuploader, labeler);

//FileUpload3 is for uploading third file
        fileuploader = FileUpload3;
        labeler = Label3;
        callme(fileuploader, labeler);

//FileUpload4 is for uploading fourth file

        fileuploader = FileUpload4;
        labeler = Label4;
        callme(fileuploader, labeler);

    }

//this function actually perform file uploading

    public void callme(FileUpload FileUploader, Label labler)
    {
        try
            {
                System.IO.FileInfo ff = new System.IO.FileInfo(FileUploader.FileName);
                String extension= ff.Extension;
                if ((extension == ".jpg") || (extension == ".gif") || (extension == ".png") || ((extension == ".bmp")))
                {
                    string filename = FileUploader.FileName;
                    String albumTitle = txtTitle.Text;
                    FileUploader.SaveAs(Server.MapPath("~/Album/") + filename);

                    bool status = SavetoDatabase(filename, albumTitle);//use this //function only if u want to save the picture info in database also
                    if (status)
                        labler.Text = "Upload status: File uploaded!";
                    else
                        labler.Text = "Upload status: File uploading Failed!";
                    
                }
                else
                {
                    labler.Text += "Upload status: Only jpg/gif/png/bmp formats are accepted!";
                }
            }
            catch (Exception ex)
            {
                labler.Text += "Upload status: The file could not be uploaded. The following error occurred: " + ex.Message;
            }
    }




    protected bool SavetoDatabase(String fileName, int albumID)
    {
    //add here logic to save the image information into database like its name 

    }

Last edited by WingedPanther; 07-07-2009 at 09:42 AM.. Reason: add code tags (the # button)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Some Basic Linux Commands, For Beginners... Onur Linux Tutorials, Guides and Tips 5 10-12-2009 03:07 AM
Java: encrypt text into an image Sinipull Classes and Code Snippets 0 06-16-2009 04:59 PM
scale image bubuzzz Java Help 3 06-01-2009 05:59 AM
Uploading unknown number of files using php & JS amrosama PHP Tutorials 4 01-08-2009 10:48 AM
Help with image upload script - need to make an if null statement norbie PHP Forum 7 05-04-2008 10:44 AM


All times are GMT -5. The time now is 08:21 AM.


vBulletin v3.8.0 ©2010, Jelsoft Enterprises Ltd.


no new posts

LinkBacks Enabled by vBSEO 3.1.0