Closed Thread
Results 1 to 3 of 3

Thread: To upload multiple image files

  1. #1
    Divya is offline Learning Programmer
    Join Date
    Apr 2008
    Location
    India
    Posts
    32
    Rep Power
    0

    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..

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    Aug 2007
    Location
    Gizeh, Al Jizah, Egypt, Egypt
    Posts
    8,675
    Blog Entries
    12
    Rep Power
    81

    Re: To upload multiple image files

    sorry for that spam above,
    ive wrote a tutorial about that heres the link
    yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
    Code:
    eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
    www.amrosama.com | the unholy methods of javascript

  4. #3
    jatin is offline Newbie
    Join Date
    Jul 2009
    Posts
    1
    Rep Power
    0

    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 06:42 AM. Reason: add code tags (the # button)

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 11-25-2010, 02:50 AM
  2. [PHP] Base Multiple File Upload Script
    By DEViANT in forum Classes and Code Snippets
    Replies: 2
    Last Post: 10-16-2010, 01:21 AM
  3. Image upload and resize
    By Bioshox in forum PHP Development
    Replies: 1
    Last Post: 07-09-2010, 02:10 AM
  4. Upload multiple file
    By claudiu in forum PHP Development
    Replies: 6
    Last Post: 01-23-2010, 07:20 AM
  5. upload image and resieze..
    By techker in forum PHP Development
    Replies: 3
    Last Post: 10-01-2008, 11:07 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts