Upload Folder

Last post 05-05-2008 8:13 AM by r_nassabeh. 7 replies.

Sort Posts:

  • Upload Folder

    03-01-2008, 7:58 PM
    • Loading...
    • DKB
    • Joined on 12-14-2005, 2:22 PM
    • Cape Cod Massachusetts
    • Posts 161

    Hi I would like to know about the upload folder in the personal kit. I uploaded about 30 pictures and it worked fine the only thing I can see that might become a problem for me is that when I logged in to manage and edit... the upload folder still contains the pictures. I want to creat a new album with new pictures. I am working with a fear amount of pictures and don't want to waste time with the uploading process by uploading and finding I have more pictures in my newly created album then I want. Is this something I am going to have to troubleshoot.

     

    DKB

    DKB
  • Re: Upload Folder

    03-01-2008, 11:21 PM
    • Loading...
    • r_nassabeh
    • Joined on 01-11-2008, 5:14 AM
    • Shiraz, Iran
    • Posts 497

    By default, Personal Starter Kit does not delete the pictures after bulk uploading them in the photoes page so you have to manually empty the folder after clicking the import button. If you want a more elegant way you can modify the Button1_Click in admin\photoes.aspx.cs to automatically delete the file after adding it with the AddPhoto method.

    Reza Nassabeh
    www.professionalcsharp.com


    Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
  • Re: Upload Folder

    03-02-2008, 8:15 AM
    • Loading...
    • DKB
    • Joined on 12-14-2005, 2:22 PM
    • Cape Cod Massachusetts
    • Posts 161

    Tank you for your help on the upload folder. I'll use your advice and start to code a button on the admin section. I have only one regret I should not have sold my vb 2005 book back to the college. Would you be kind enough to remind me where to begin such a task... not the answer... just a hint where to begin @ I can create the button and I think I could do a if statement.

     

    DKB

    DKB
  • Re: Upload Folder

    03-02-2008, 8:50 AM
    • Loading...
    • r_nassabeh
    • Joined on 01-11-2008, 5:14 AM
    • Shiraz, Iran
    • Posts 497

    I'm using the C# version but the VB would not differ greatly. You dont need to add another button, just locate the photoes.aspx page under the Admin folder, right-click and select view code, locate the Button1_Click event handler. in c# it looks like this:

     

    protected void Button1_Click(object sender, ImageClickEventArgs e) {
    	DirectoryInfo d = new DirectoryInfo(Server.MapPath("~/Upload"));
    	foreach (FileInfo f in d.GetFiles("*.jpg")) {
    		byte[] buffer = new byte[f.OpenRead().Length];
    		f.OpenRead().Read(buffer, 0, (int)f.OpenRead().Length);
    		PhotoManager.AddPhoto(Convert.ToInt32(Request.QueryString["AlbumID"]), f.Name, buffer);
                                    // Place to delete the image file
                                    f.Delete();
    	}
    	GridView1.DataBind();
    }
    and of course you must have appropriate permissions to delete the file from the server.
     
    Reza Nassabeh
    www.professionalcsharp.com


    Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
  • Re: Upload Folder

    03-02-2008, 11:32 AM
    • Loading...
    • DKB
    • Joined on 12-14-2005, 2:22 PM
    • Cape Cod Massachusetts
    • Posts 161

    Thank you I will let you know how it works

     

    DKB

    DKB
  • Re: Upload Folder

    05-05-2008, 12:36 AM
    • Loading...
    • karanpaul
    • Joined on 05-03-2008, 9:40 AM
    • Posts 33

    please help me how to Upload my folder which contains many files.which is often called BulkUpload in asp.net ,C#,webapplication

  • Re: Upload Folder

    05-05-2008, 1:38 AM
    • Loading...
    • karanpaul
    • Joined on 05-03-2008, 9:40 AM
    • Posts 33

    Hai DBK,

     Please help me how to Upload a folder in asp.net ,C#.give me any solution

    Thks

    Paul

  • Re: Upload Folder

    05-05-2008, 8:13 AM
    • Loading...
    • r_nassabeh
    • Joined on 01-11-2008, 5:14 AM
    • Shiraz, Iran
    • Posts 497

    Hi

    Thereis a very good sample about uploading all images inside a folder to the server in Personal Web Starter Kit.Follow the following path and take a look at the code:

    Click on File | New web site | Personal Web Starter Kit

    goto Admin | Photoes.aspx.cs and take a look at Button1_Click

    I hope it gives you a good insight.

    Reza Nassabeh
    www.professionalcsharp.com


    Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
Page 1 of 1 (8 items)
Microsoft Communities
Page view counter